通過以下紅色部分的欄目id來控制顯示哪些欄目,id根據實際情況後台查詢,subcat函數看最後附件解釋,以下修改代碼:
{loop subcat(0,0,0,$siteid) $r}
http://blog.csdn.net/a1079540945/article/details/{$r}更多>>
{str_cut($v['description'],100)}
{loop subcat(0,0,0,$siteid) $r}
{if $r['catid']==3 }{/if} //排除某個欄目
http://blog.csdn.net/a1079540945/article/details/{$r}更多>>
{str_cut($v['description'],100)}
=====================================================
{loop subcat(0,0,0,$siteid) $r}{/loop}函數解釋:
{loop subcat(0,0,0,$siteid) $r}{/loop}
/**
* 獲取子欄目
* @param $parentid 父級id
* @param $type 欄目類型 1為單網頁類型,0為欄目類型;(查看phpcms的mysql數據庫可以看到)
* @param $self 是否包含本身 0為不包含
* @param $siteid 站點id
*/
function subcat($parentid = NULL, $type = NULL,$self = '0', $siteid = '') {
if (empty($siteid)) $siteid = get_siteid();
$category = getcache('category_content_'.$siteid,'commons');
foreach($category as $id=>$cat) {
if($cat['siteid'] == $siteid && ($parentid === NULL || $cat['parentid'] == $parentid) && ($type === NULL || $cat['type'] ==
$type)) $subcat[$id] = $cat;
if($self == 1 && $cat['catid'] == $parentid && !$cat['child']) $subcat[$id] = $cat;
}
return $subcat;
}