解决lists标签中,加上where后其他条件失效的问题

发表于2013-11-25 15:32:01来源于创想网页设计工作室

次点击[] [] [] [打印] [关闭窗口] [评论]

欢迎大家加入创想工作室QQ群 网络瘫痪上不了网?电脑出故障?找破解软件?加入创想工作室QQ群,向大神求助,一步解决问题!QQ群号码:326338868[点此获取更多QQ群]
问题描述:
{pc:content action="lists" catid="$catid" where="posids`!='0'" thumb="1" num="10"}
发现不是调用当前栏目而是全部栏目的,并且不管有没有缩略图都显示出来,在PHPCMS官方论坛搜索了一下,发现这个问题存在很久了。今天我们说一下怎么修复吧!
 
打开/phpcms/modules/content/classes/目录下的content_tag.class.php这个文件,把下面的代码(大概第63行)
if(isset($data['where'])) {
$sql = $data['where'];
} else {
$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;
}
}
替换为下面的代码即可。
/*以下为创想工作室修改开始*/
if(isset($data['where'])) {
$where = (isset($data['where'])&&(!empty($data['where'])))?' AND '.$data['where']:'';
$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".$where." AND catid IN ($catids_str)".$thumb;
} else {
$sql = "status=99".$where." AND catid='$catid'".$thumb;
}
} else {
$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;
}
}
/*以上为创想工作室修改结束*/

相关热词搜索:listswhere标签

© copyright 2002-2024, 22BA.COM All Rights Reserved

网站备案号:粤ICP备19114910号

ChuangXiang Design Studio - WebDesign & Internet Marketing

关于我们业务范围联系我们开心一刻网站地图

QQ群一:326338868QQ群二:78712271

QQ群三:193078177

邮箱:news@22ba.com

地址:深圳市福田区金田路现代国际大厦2606