邏輯上后臺(tái)文章狀態(tài)關(guān)閉了,那么前臺(tái)的這篇文章生成出來的tag就應(yīng)該消失掉,但是現(xiàn)在PbootCMS默認(rèn)的并沒有根據(jù)文章狀態(tài)顯示隱藏。在平時(shí)一般使用中可能影響不大,但是碰到類似本站右側(cè)有tags列表展示,而且還配了數(shù)量顯示,那么當(dāng)用戶看到明明顯示有數(shù)量點(diǎn)擊進(jìn)去卻沒有,這種體驗(yàn)效果就很差。那么現(xiàn)在就來講下如何修復(fù)這個(gè)問題,實(shí)現(xiàn)tag標(biāo)簽可以隨文章狀態(tài)實(shí)現(xiàn)顯示和隱藏。
教程如下
打開\apps\home\model\ParserModel.php文件
找到

$result = parent::table('ay_content a')->where("c.type=2 AND a.tags<>''")
    ->where($scode_arr, 'OR')
    ->join($join)
    ->order('a.visits DESC')
    ->column('a.tags');
return $result;

改成

$result = parent::table('ay_content a')->where('a.status=1')->where("c.type=2 AND a.tags<>''")
    ->where($scode_arr, 'OR')
    ->join($join)
    ->order('a.visits DESC')
    ->column('a.tags');
return $result;