PDA

View Full Version : دینامیک کردن صفحه



mehdirani
شنبه 20 دی 1393, 17:45 عصر
سلام می شه این فایل بیشتر دینامیک بشه



<!DOCTYPE html><html dir="rtl" lang="fa-IR" prefix="og: http://ogp.me/ns#"><head> <link type="text/css" rel="stylesheet" href="css/style1.css"><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title></title>
<?php include 'config.php'; ?>
<?php include 'header.php';?><body>

<div class="content"><div class="two-box-warpper"><div class="page-body">
<?php $posts = mysql_query("SELECT * FROM `posts` ORDER BY id DESC"); $num_post = mysql_num_rows($posts); $limit = 10;//تعداد مطلب در هر صفحه if(!isset($_GET['page'])){ $page = 1; } else { $page = $_GET['page']; } $limitvalue = $page * $limit - ($limit); $posts = mysql_query("SELECT * FROM `posts` ORDER BY id DESC LIMIT $limitvalue, $limit"); if(mysql_num_rows($posts) > 0){
while($post = mysql_fetch_array($posts)){ $pageID = $post['id']; // The ID of the page, the article or the video ...
echo'<div class="post">'."\n"; echo'<div class="post-title">'."\n"; echo'<div class="iconbl-post">'."\n"; echo'<span class="icon-comments"></span>'."\n"; echo'</div>'."\n"; echo'<h3><a href="" rel="bookmark" title="'.$post['subject'].'">'.$post['subject'].'</a></h3>'."\n"; echo'<div class="like">'; echo '<form action="like.php" target="_blank" method="post">'; echo '<input class="bluekey comment-button1" type="submit" name="like" value="لایک بزن"/>'."\n"; echo ' <input type="hidden" name="idm" value="'.$post['id'].'">'."\n";
echo'</form>'; echo'</div>'."\n"; echo'</div>'."\n";
echo'<div class="contents">'."\n"; echo'<div class="rightinfo">'."\n"; echo'<div class="view"><span>'.$post['id'].'</span><p>شماره پست</p></div>'."\n"; echo'<div class="view"><span>'.$post['username'].'</span><p>نویسنده</p></div>'."\n"; echo'<div class="view"><span>'.$post['rate'].'</span><p>تعداد لایک</p></div>'."\n"; echo'<a href=""><div class="view"><span><a target="_blank" href="report.php?idrep='.$post['id'].'"><p>گزارش</p><p>این پست</p></a></span></div></a>'."\n";

echo'</div>'."\n"; echo'<div class="contentpost">'."\n"; echo'<div class="m">'.$post['post'].'</div>'."\n";

?>


<?php echo'</div>'."\n"; echo'</div>'."\n"; echo'</div>'."\n"; } } ?> <div class="entry"><div class='wp-pagenavi'>
<?php $num_pages = ceil($num_post / $limit); if($num_pages > 1){ $page_count = 0; for($x=0;$x<$num_pages;$x++){ $page_count++; $number = $x + 1; if($page != $number){ echo '<a href="index.php?page='.$number.'" class="pages">'.$number.''; } if($page != $number){ echo '</a>'; } else{ echo'<span class="pages">'.$number.'</span>'; } }
} ?> </div></div></div>
<?php include 'sidebar.php'; ?><div class="clear"></div></div>

<?php include 'footer.php'; ?> <?php //function to calculate the percent function percent($num_amount, $num_total) { $count1 = $num_amount / $num_total; $count2 = $count1 * 100; $count = number_format($count2, 0); return $count; } ?> </body></html>