首页 > CMS建站 > PhpCMS > 正文

phpcms怎样让父栏目支持分页

2020-10-10 21:04:11
字体:
来源:转载
供稿:网友

打开include/html.class.php文件,找到第53行:

$arrchildid = subcat('phpcms',$catid);

前面添加如下代码:

if($page == 0) $page = 1;

打开admin/html.inc.php文件,找到61行至80行:

  1. if($CATEGORY[$catid]['child']) 
  2.     { 
  3.      $pages = 1; 
  4.      $html->category($catid); 
  5.     } 
  6.     else 
  7.     { 
  8.      $offset = $pagesize*($page-1); 
  9.      if($page == 1) 
  10.      { 
  11.       $contents = cache_count("SELECT COUNT(*) AS `count` FROM `".DB_PRE."content` WHERE catid=$catid AND status=99"); 
  12.       $total = ceil($contents/$PHPCMS['pagesize'])+1; 
  13.       $pages = ceil($total/$pagesize); 
  14.      } 
  15.      $max = min($offset+$pagesize$total); 
  16.      for($i=$offset$i<$max$i++) 
  17.      { 
  18.       $html->category($catid$i); 
  19.      } 
  20.     } 
  21.  
  22. //改为: 
  23.      $offset = $pagesize*($page-1); 
  24.      if($page == 1) 
  25.      { 
  26.       $condition=get_sql_catid($catid); 
  27.       $contents = cache_count("SELECT COUNT(*) AS `count` FROM `".DB_PRE."content` WHERE status=99 $condition"); 
  28.       $total = ceil($contents/$PHPCMS['pagesize'])+1; 
  29.       $pages = ceil($total/$pagesize); 
  30.      } 
  31.      $max = min($offset+$pagesize$total); 
  32.      for($i=$offset$i<$max$i++) 
  33.      {  //Cuoxin.com 
  34.       $html->category($catid$i); 
  35.      }

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表