打開category.php頁面
步驟一:找到“ $smarty->assign('ur_here', $position['ur_here']); // 當(dāng)前位置”(大概在334行),在這行下面加上以下代碼。
$smarty->assign('current_cat_id', $cat_id); //取得當(dāng)前的id
$catlist = array();
foreach(get_parent_cats($cat_id) as $k=>$v)
{ $catlist[] = $v['cat_id']; }
$smarty->assign('current_cat_pr_id',$catlist[count($catlist)-1]);
if (count($catlist)>=2)
{ $smarty->assign('current_cat_t_id',$catlist[count($catlist)-2]); }
步驟二:在模板庫文件中直接引用就可以了,代碼如下:
$current_cat_pr_id
判斷是否與當(dāng)前分類ID是否相等,引用不同Css模板,代碼以下:
class="<!--{if $current_cat_pr_id eq $cat.id}-->haha<!--{else}-->hb<!--{/if}-->"
新聞熱點
疑難解答
圖片精選