PHPCMS下一页分页链接到后台的问题【解决办法】
发布:smiling 来源: PHP粉丝网 添加日期:2014-10-21 16:52:14 浏览: 评论:0
PHPCMS生成静态页面之后,点下一页直接链接到后台了,打开include/global.func.php文件,找到 function pages函数,将整个函数修改为如下代码:
- function pages($num, $curr_page, $perpage = 20, $urlrule = '', $array = array(), $catid = 0)
- {
- global $PHPCMS;
- if($PHPCMS['pagemode'] && $num > $perpage)
- {
- $multipage = '';
- if($num > $perpage)
- {
- $page = 11;
- $offset = 4;
- $pages = ceil($num / $perpage);
- $from = $curr_page - $offset;
- $to = $curr_page + $offset;
- $more = 0;
- if($page >= $pages)
- {
- $from = 2;
- $to = $pages-1;
- }
- else
- {
- if($from <= 1)
- {
- $to = $page-1;
- $from = 2;
- }
- elseif($to >= $pages)
- {
- $from = $pages-($page-2);
- $to = $pages-1;
- }
- $more = 1;
- }
- if($urlrule == '') $urlrule = url_par('page={$page}');
- $url = load('url.class.php');
- $multipage .= '总数:<b>'.$num.'</b> ';
- if($curr_page>0)
- {
- $multipage .= $catid ? '<a href="'.$url->category($catid, $curr_page-1, 1, 1).'">上一页</a>' : '<a href="'.pageurl($urlrule, $curr_page-1, $array).'">上一页</a>';
- if($curr_page==1)
- {
- $multipage .= '<u><b>1</b></u> ';
- }
- elseif($curr_page>6 && $more)
- {
- $multipage .= $catid ? '<a href="'.$url->category($catid, 1, 1, 1).'">1</a>..' : '<a href="'.pageurl($urlrule, 1, $array).'">1</a>..';
- }
- else
- {
- $multipage .= $catid ? '<a href="'.$url->category($catid, 1, 1, 1).'">1</a>' : '<a href="'.pageurl($urlrule, 1, $array).'">1</a> ';
- }
- }
- for($i = $from; $i <= $to; $i++)
- {
- if($i != $curr_page)
- {
- $multipage .= $catid ? '<a href="'.$url->category($catid, $i, 1, 1).'">'.$i.'</a> ' : '<a href="'.pageurl($urlrule, $i, $array).'">'.$i.'</a> ';
- }
- else
- {
- $multipage .= ' <u><b>'.$i.'</b></u> ';
- }
- }
- if($curr_page<$pages)
- {
- if($curr_page<$pages-5 && $more)
- {
- $multipage .= $catid ? '..<a href="'.$url->category($catid, $pages, 1, 1).'">'.$pages.'</a> <a href="'.$url->category($catid, $curr_page+1, 1, 1).'">下一页</a>' : '..<a href="'.pageurl($urlrule, $pages, $array).'">'.$pages.'</a> <a href="'.pageurl($urlrule, $curr_page+1, $array).'">下一页</a>';
- }
- else
- {
- $multipage .= $catid ? '<a href="'.$url->category($catid, $pages, 1, 1).'">'.$pages.'</a> <a href="'.$url->category($catid, $curr_page+1, 1, 1).'">下一页</a>' : '<a href="'.pageurl($urlrule, $pages, $array).'">'.$pages.'</a> <a href="'.pageurl($urlrule, $curr_page+1, $array).'">下一页</a>';
- }
- }
- elseif($curr_page==$pages)
- {
- $multipage .= ' <u><b>'.$pages.'</b></u><a href="'.$url->category($catid, $curr_page, 1, 1).'">下一页</a>';
- }
- }
- return $multipage;
- }
- else
- {
- $total = $num;
- $page = $curr_page;
- if($num < 1) return '';
- if($urlrule == '') $urlrule = url_par('page={$page}');
- $pages = ceil($total/$perpage);
- $page = min($pages, $page);
- $prepage = $page - 1;
- $prepage = max($prepage, 1);
- $nextpage = $page+1;
- $nextpage = min($nextpage, $pages);
- if($catid)
- {
- $url = load('url.class.php');
- $firstpage = $url->category($catid, 1, 1, 1);
- $prepage = $url->category($catid, $prepage, 1, 1);
- $nextpage = $url->category($catid, $nextpage, 1, 1);
- $lastpage = $url->category($catid, $pages, 1, 1);
- $urlpre = $url->category($catid, '', 1, 1);
- }
- else
- {
- $firstpage = pageurl($urlrule, 1, $array);
- $prepage = pageurl($urlrule, $prepage, $array);
- $nextpage = pageurl($urlrule, $nextpage, $array);
- $lastpage = pageurl($urlrule, $pages, $array);
- $urlpre = pageurl($urlrule, '', $array);
- }
- $data = str_replace('"', '\"', $PHPCMS['pageshtml']);
- eval_r("\$url = \"$data\";");
- return $url; //phpfenis.com
- }
- }
Tags: PHPCMS下一页分页 PHPCMS后台
相关文章
- ·用PHPCMS v9做网站前必做的几件事(2014-10-19)
- ·phpcms v9忘记后台密码解决方法(2014-10-19)
- ·phpcms dedecms后台密码怎么修改(2014-10-19)
- ·解决phpcms栏目过多导致后台缓慢的问题(2014-10-19)
- ·phpcms v9 更改后台排序问题(2014-10-19)
- ·【phpcms-v9】后台content模块的content.php控制器文件分析-后台添(2014-10-23)
- ·【phpcms-v9】解决后台栏目管理只显示顶级栏目名而不显示子(2014-10-23)
- ·【phpcms-v9】后台发布文章时切换栏目的功能实现(2014-10-23)
- ·【phpcms-v9】phpcms-v9中后台编辑人员的权限控制(2014-10-23)
- ·phpcms v9 中 PHPSSO无法通讯解决方法(PHPSSO无法通讯间接影响php(2014-10-24)
- ·phpcms v9屏蔽后台版本更新提示方法总结(2014-11-27)
- ·Phpcms V9修改后台登录入口地址(2014-12-04)
- ·PHPCMS修改模板路径及后台地址 增强安全(2015-12-07)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)