【phpcms】关于无子栏目的栏目如何既能显示频道页又能显示列表页

  今天用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);}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值