修改 ./include/html.class.php ,將第 58 行提至 51 行前,整個從 49 行到 61 行由:
- if($type == 0)
- {
- if($child==1)
- {
- $arrchildid = subcat('phpcms',$catid);
- $template = $template_category;
- }
- else
- {
- if($page == 0) $page = 1;
- $template = $template_list;
- }
- }
- //變為
- if($type == 0)
- {
- if($page == 0) $page = 1;
- if($child==1)
- {
- $arrchildid = subcat('phpcms',$catid);
- $template = $template_category;
- }
- else
- {
- $template = $template_list;
- }
- }
此為第一步,接著修改 ./admin/html.inc.php,將從 61 行到 80 行由:
- if($CATEGORY[$catid]['child'])
- {
- $pages = 1;
- $html->category($catid);
- }
- else
- {
- $offset = $pagesize*($page-1);
- if($page == 1)
- {
- $contents = cache_count("SELECT COUNT(*) AS `count` FROM `".DB_PRE."content` WHERE catid=$catid AND status=99");
- $total = ceil($contents/$PHPCMS['pagesize']);
- $pages = ceil($total/$pagesize);
- }
- $max = min($offset+$pagesize, $total);
- for($i=$offset; $i<=$max; $i++)
- {
- $html->category($catid, $i);
- }
- }
- //修改為
- $offset = $pagesize*($page-1);
- if($page == 1)
- {
- $condition=get_sql_catid($catid);
- $contents = cache_count("SELECT COUNT(*) AS `count` FROM `".DB_PRE."content` WHERE status=99 $condition");
- $total = ceil($contents/$PHPCMS['pagesize'])+1;
- $pages = ceil($total/$pagesize);
- }
- $max = min($offset+$pagesize, $total);
- for($i=$offset; $i<$max; $i++)
- { //Vevb.com
- $html->category($catid, $i);
- }
變成了 61 行到 73行,如此,重新生成 html,一級欄目如果使用 tag 標簽調用,開啟了分頁,就應該可以出現分頁了.
新聞熱點
疑難解答