phpcms2008 栏目页分页

现在将方法描述如下:

修改 ./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++)
    {
     $html->category($catid, $i);
    }

变成了 61 行到 73行,如此,重新生成 html,一级栏目如果使用 tag 标签调用(开启了分页)就应该可以出现分页了。


http://hi.baidu.com/jone%5Flinux/blog/item/dcad82cb53e45cf052664fa0.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值