من هنوز نتونستم کد لازم برای صفحه بندی مطالب اخبار رو توی phpپیدا کنم لطفا کمک کنید
Printable View
من هنوز نتونستم کد لازم برای صفحه بندی مطالب اخبار رو توی phpپیدا کنم لطفا کمک کنید
[PHP]<?php
//codehaye namayesh
$num = $_GET['num'];
if(($num == "") OR ($num == "1")) {
$num2 = '0'; } else {
$man = ($num *= 7); // bejaye 7 bayad nesfe tedadi ro ke mikhay namayesh bedi bezari
$num2 = $man;
}
$show = mysql_query("SELECT * FROM table_name LIMIT $num2,14"); // 14 tedade namayesh hastesh
while($s = mysql_fetch_array($show)){
$text = $s['$text']; // meghadre field ha dar yek moteghayer
print $text;
}
?>
<?php
// code haye safhe bandi
list($count) = mysql_fetch_row(mysql_query("SELECT COUNT(id) FROM table_name"));
$x = intval($count / 14)+1; // adade 14 tedade namayesh dar har safhe mibashad ke mitoni 16 , 18 , 20 va ... bezari ke bayad dar bala niz taghirat ro bedi
for ($i=1; $i<$x; $i++){
echo "<font face='Tahoma' style='font-size: 8pt; color='#2E456B'><a href='?num=$i'>
<font color='#32567E'>" . $i . "</font></a></font><font face='Tahoma' style='font-size: 8pt' color='#32567E'></b>
</font><font face='Tahoma' style='font-size: 8pt' color='#4D5964'>|</font></b></font>
";
}
echo"<font face='Tahoma' style='font-size: 8pt; color='#2E456B'><a href='?num=$x'>
<font color='#32567E'>" . $x . "</font></a></font><font face='Tahoma' style='font-size: 8pt' color='#32567E'></b>
</font><font face='Tahoma' style='font-size: 8pt' color='#4D5964'>|</font></b></font>
";
?>[/PHP]
سلام
این کد هم نمایش رو درست میکنه و در زیره نمایش صفحه بندی رو انجام میده توضیحاتی نیز در جاهای مورد احتیاجت قرار دادم :31:
البته بزرگان مارو ببخشن :31: