PHPCMS 按照类别typeid调用文章列表

v9版本默认是没有typeid这个参数的调用。

修改方法:

模板
在pc标签中加入typeid参数(栏目下需要根据分类调用信息就加,不需要就不用加),如下:
{pc:content action=”lists” catid=”17″ typeid=”57″ order=”id DESC” thumb=”” moreinfo=”1″ num=”10″ }
{/pc}

程序更改:
1、找到phpcms\modules\conetent\classes\content_tag.class.php文件中的public function lists($data) {}函数;
2、将代码

$thumb = intval($data[‘thumb’]) ? ” AND thumb != ”” : ”;
if($this->category[$catid][‘child’]) {
$catids_str = $this->category[$catid][‘arrchildid’];
$pos = strpos($catids_str,’,’)+1;
$catids_str = substr($catids_str, $pos);
$sql = “status=99 AND catid IN ($catids_str)”.$thumb;
} else {
$sql = “status=99 AND catid=’$catid'”.$thumb;
}

更改为:

$thumb = intval($data[‘thumb’]) ? ” AND thumb != ”” : ”;
$typeids = intval($data[‘typeid’]) ? ” AND typeid = ‘”.intval($data[‘typeid’]).”‘” : ”;
if($this->category[$catid][‘child’]) {
$catids_str = $this->category[$catid][‘arrchildid’];
$pos = strpos($catids_str,’,’)+1;
$catids_str = substr($catids_str, $pos);
$sql = “status=99 AND catid IN ($catids_str)”.$typeids.$thumb;
} else {
$sql = “status=99 AND catid=’$catid'”.$typeids.$thumb;
}

发表评论