php分页代码(实用的分页程序)
发布:smiling 来源: PHP粉丝网 添加日期:2014-08-16 13:45:15 浏览: 评论:0
- function pagenavi($total, $offset){
- global $conf_pagemax;
- global $conf_home;
- global $conf_pastlog;
- global $view;
- $next = $offset + $conf_pagemax;
- $prev = $offset - $conf_pagemax;
- echo " <!-- page navigation --> ";
- if($offset > $conf_pagemax-1){
- echo "<a href="index.php?offset=$prev";
- if($view == "past"){
- echo "&view=past";
- }
- echo ""><<上一页</a> ";
- }
- ($total % $pagemax)? $pagenum = ($total/$conf_pagemax) + 1: $pagenum = ($total/$conf_pagemax);
- if($total <= $conf_pagemax) $pagenum = 0;
- $c = 0;
- $page = 1;
- if($total > $conf_pagemax){
- echo "[<b> ";
- while($pagenum > 0){
- if($offset == $c){
- $str .= " $page ";
- } else {
- $str .= " <a href="index.php?offset=$c";
- if($view =="past"){
- $str .= "&view=past";
- }
- $str .= "">$page</a> ";
- }
- $page++;
- $pagenum--;
- $c = $c + $conf_pagemax;
- }
- echo "$str </b>] ";
- }
- if($next < $total){
- echo "<a href="index.php?offset=$next";
- if ($view == "past"){
- echo "&view=past";
- }
- echo "">下一页>></a> ";
- }
- echo "</td></tr></table>";
- echo " <!-- end of page navigation --> <br><br>";
- echo "
- [ <a href="$conf_home">返回主页</a> ]
- ";
- if($view != "past"){
- if(file($conf_pastlog)){
- echo "[ <a href="index.php?view=past">以前的留言</a> ]";
- }
- }
- echo " [ <a href="search.php"> 搜索</a> ] ";
- echo " [ <a href="index.php">留言板首页</a> ] ";
- }
Tags: php分页代码 实用分页程序
- 上一篇:经典php分页代码,支持数字偏移
- 下一篇:php入门级别的分页函数
相关文章
- ·php分页代码与分页原理(2013-11-12)
- ·简单入门级php分页代码(2014-05-10)
- ·两款实用php分页代码(2014-08-15)
- ·经典php分页代码,支持数字偏移(2014-08-15)
- ·php分页代码(下一页 上一页)(2014-08-16)
- ·php分页代码(2014-08-16)
- ·php简单分页实例程序代码详解(2014-09-22)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)