PHP7中文手册2018 带注释 最新chm版
问题描述:
{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; } } |