Đây là đoạn code mình đã FIX lại và Design xin Share cho ai cần.
<style>
#pagination-digg li { border:0; margin:0; padding:0; font-size:11px; list-style:none; /* savers */ float:left; }
#pagination-digg a { border:solid 1px #9aafe5; margin-right:2px; }
#pagination-digg .active { background:#2e6ab1; color:#FFFFFF; font-weight:bold; display:block; float:left; padding:4px 6px; /* savers */ margin-right:2px; }
#pagination-digg a:link,
#pagination-digg a:visited { color:#0e509e; display:block; float:left; padding:3px 6px; text-decoration:none; }
#pagination-digg a:hover { border:solid 1px #0e509e; }
</style>
<?phpfunction page_div($link, $offset, $numofpages, $page) {$numofpages = ceil($numofpages);$pagesstart = ceil($page-$offset);$pagesend = ceil($page+$offset);
if ($page != "1" && ceil($numofpages) != "0")
{
echo str_replace('%d_pg', ceil($page-1), " <a href=".$link." ><b>< Pre</b></a> ");
}
for($i = 1; $i <= $numofpages; $i++)
{
if ($pagesstart <= $i && $pagesend >= $i)
{
if ($i == $page)
{
echo "<b class=active>$i</b> ";
}
else
{
echo str_replace('%d_pg', "$i", '<a href="'.$link.'"><b>'.$i.'</b></a> ');
}
}
}
if (ceil($numofpages) == "0")
{
echo "$i";
}
if ($page != ceil($numofpages) && ceil($numofpages) != "0")
{
echo str_replace('%d_pg', ceil($page+1), '<a href="'.$link.'"><b> Next</b></a>');
}
}
include('../connections.php');$pp = "10"; $p_now=$_GET['p'];
$q2 = "SELECT count(*) as tot FROM cn05b_sanpham"; $s2 = mysql_query($q2,$link);$r2 = @mysql_fetch_array($s2);
$numofpages = $r2['tot'] / $pp;
if (!$p_now) {$page = 1;}
else {$page = $p_now;}$limitvalue = $page * $pp - ($pp);//lấy dữ liệu cho trang$sql="SELECT * FROM cn05b_sanpham LIMIT $limitvalue, $pp";// hiển thị dữ liệu?><div id=pagination-digg> <?// in phân trangecho 'Pages: '.ceil($numofpages).'<br>';page_div("?action=donow&p=%d_pg", "5", ceil($numofpages), $page); ?> </div>
0 comments: