今天用phcms做一个网站,需要用到无子栏目的栏目如何既能显示频道页又能显示列表页,在网上查找方法。
找到了这个 http://blog.csdn.net/yanhui_wei/article/details/8007310
试了一下发现根本不管用,不知道以上的根据是什么,此段根本与主题无关,误人子弟。
自己研究了下,说一下方法,这个方法只是暂时的,或许还有更好的方法。
主要修改两个文件phpcms\modules\content\create_html.php和phpcms\modules\content\classes\html.class.php
生成频道页和列表页有两处,分别为发布新文章和批量更新栏目列表时。
1。发布新文章:
修改文件phpcms\modules\content\classes\html.class.php
1复制函数category并更名为category1,
注释掉行
//$template = $child ? $template : $template_list;
2修改函数create_relation_html
/**
* 生成相关栏目列表、只生成前5页
* @param $catid
*/
public function create_relation_html($catid) {
for($page = 1; $page < 6; $page++) {
$this->category($catid,$page);
if($page==1){$this->category1($catid,$page);}
}
//检查当前栏目的父栏目,如果存在则生成
$arrparentid = $this->categorys[$catid]['arrparentid'];
if($arrparentid) {
$arrparentid = explode(',', $arrparentid);
foreach ($arrparentid as $catid) {
if($catid) $this->category($catid,1);
if($page==1){$this->category1($catid,$page);}
}
}
}
2。批量更新栏目列表:
修改文件phpcms\modules\content\create_html.php
找到函数category在456行下添加
if($page==1){$this->html->category1($catid,$page);}