萬能分頁顯示上一頁下一頁
阿新 • • 發佈:2019-02-03
<?php
$count = count($list);//記錄總條數
$page_size = 12; //每頁顯示條數
$page_all = ceil($count/$page_size);//總頁數
@$page = $_GET['page'] ? $_GET['page'] :1; //當前頁數
$page_up = $page-1 > 1 ?$page-1 :1; //上一頁
$page_next = $page+1 > $page_all ?$page_all :$page+1;//下一頁
$key = ($page-1)*$page_size;
for($i = 0; $i < $page_size; $i++){
if(!isset($list[($page - 1) * $page_size + $i]))break;
echo "<li class='imagetype_li' style='padding-right:0px;'>
<a href='xiangqing.php?id={$arry[($page - 1) * $page_size + $i]['GID']}'>
<img style='border:1px solid #ccc;width:150px;height:112px'; src='images/{$arry[($page -
1) * $page_size + $i]['url']}'/></a>
<h5><a>{$arry[($page - 1) * $page_size + $i]['name']}</a></h5><>";
}
echo "</ul><br class='clear' /></div></div></div></div></div><div class='websiteMain1'><a
href='yangpingzhanshi.php?page=1&lei={$lei}'>首頁 </a><a href='yangpingzhanshi.php?page=
{$page_up}&lei={$lei}'> 上一頁 </a><a href='yangpingzhanshi.php?page={$page_next}&lei=
{$lei}'> 下一頁 </a><span> 共 {$page_all} 頁 </span><span> 第 {$page} 頁 </span>";
?>
$count = count($list);//記錄總條數
$page_size = 12; //每頁顯示條數
$page_all = ceil($count/$page_size);//總頁數
@$page = $_GET['page'] ? $_GET['page'] :1; //當前頁數
$page_up = $page-1 > 1 ?$page-1 :1; //上一頁
$page_next = $page+1 > $page_all ?$page_all :$page+1;//下一頁
$key = ($page-1)*$page_size;
for($i = 0; $i < $page_size; $i++){
if(!isset($list[($page - 1) * $page_size + $i]))break;
echo "<li class='imagetype_li' style='padding-right:0px;'>
<a href='xiangqing.php?id={$arry[($page - 1) * $page_size + $i]['GID']}'>
<img style='border:1px solid #ccc;width:150px;height:112px'; src='images/{$arry[($page -
1) * $page_size + $i]['url']}'/></a>
<h5><a>{$arry[($page - 1) * $page_size + $i]['name']}</a></h5><>";
}
echo "</ul><br class='clear' /></div></div></div></div></div><div class='websiteMain1'><a
href='yangpingzhanshi.php?page=1&lei={$lei}'>首頁 </a><a href='yangpingzhanshi.php?page=
{$page_up}&lei={$lei}'> 上一頁 </a><a href='yangpingzhanshi.php?page={$page_next}&lei=
{$lei}'> 下一頁 </a><span> 共 {$page_all} 頁 </span><span> 第 {$page} 頁 </span>";
?>