织梦模板DEDECMS不显示未审核tag标签文档的的方法

未审核文档的TAG会显示在TAG列表页面, 固然点击进入TAG时, 相关的未审核文章不会显示出来, 这样对用户体验是很不好的. DEDECMS暂时没有提供这个功能,所以要解决这个问题, 让DEDECMS不显示未审核文档的TAG, 就要修改TAG的显示库文件 tag.lib.php。
方法一
打开 /include/taglib/tag.lib.php 文件
找到

if(!empty($typeid)) {
     $addsql = " where typeid='$typeid' ";
 }

修改为

$dsql->SetQuery("Select tid From dede_taglist where arcrank<=-1"); $dsql->Execute();
 $ids = '';
 while($row = $dsql->GetArray()) {
     $tid = $row['tid'];
     $cquery = "Select count(*) as dd From dede_taglist where tid = $tid and arcrank<=-1";     $crow = $dsql->GetOne($cquery);
     if(!$crow['dd']) {
         $ids .= ( $ids=='' ? $row['tid'] : ','.$row['tid'] );
     }
 }
 if($ids != '') {
     $addsql= " where id not in($ids) ";
 }
 if(!empty($typeid)) {
     if($addsql) {
         $addsql= " and typeid='$typeid' ";
     } else {
         $addsql= " where typeid='$typeid'" ;
     }
 }

方法二
找到

$row['keyword'] = $row['tag'];

在其前边加入:

$rankrowss = $dsql -> GetOne("SELECT count(tid) as rankcount FROM `dede_taglist` WHERE tid = $row[id] and arcrank >= 0");
if($rankrowss[rankcount] == 0) continue;

通过以上两种方法就可以实现不显示未审核文档的tag标签

注明:本文为星速云原创版权所有,禁止转载,一经发现将追究版权责任!

(0)
上一篇 2022年8月9日 上午9:08
下一篇 2022年8月9日 上午9:08

相关推荐

发表评论

登录后才能评论
问答社区 QQ客服
微信客服
微信客服
分享本页
返回顶部