网(LieHuo.Net)教程 针对V5.3中的tag标签指定栏目ID无效的解决方法,红色的地方是我后加上的,你可以把以前的全部覆盖也可以。
第一步:修改include/taglib/tag.lib.php这个文件
以下为引用的内容: <?php //function GetTags($num,$ltype='new',$InnerText='') function lib_tag(&$ctag,&$refObj) { global $dsql,$envs,$cfg_cmsurl; //属性处理 $attlist="row|30,sort|new,getall|0,typeid|0"; FillAttsDefault($ctag->CAttribute->Items,$attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $InnerText = $ctag->GetInnerText(); if(trim($InnerText)=='') $InnerText = GetSysTemplets('tag_one.htm'); $revalue = ''; $ltype = $sort; $num = $row; $addsql = ''; if($getall==0 && !empty($refObj->Fields['tags']) && !empty($refObj->Fields['aid'])) { $dsql->SetQuery("Select tid From `dede_taglist` where aid = '{$refObj->Fields['aid']}' "); $dsql->Execute(); $ids = ''; while($row = $dsql->GetArray()) { $ids .= ( $ids=='' ? $row['tid'] : ','.$row['tid'] ); } if($ids != '') { $addsql = " where id in($ids) "; } } else { if(!empty($typeid)) { $addsql = " ta join `dede_taglist` tb on ta.id=tb.tid where tb.typeid='$typeid' "; } } if($ltype=='rand') $orderby = ' rand() '; else if($ltype=='week') $orderby=' weekcc desc '; else if($ltype=='month') $orderby=' monthcc desc '; else if($ltype=='hot') $orderby=' count desc '; else $orderby = ' addtime desc '; $dsql->SetQuery("Select * From `dede_tagindex` $addsql order by $orderby limit 0,$num"); $dsql->Execute(); $ctp = new DedeTagParse(); $ctp->SetNameSpace('field','[',']'); $ctp->LoadSource($InnerText); while($row = $dsql->GetArray()) { $row['keyword'] = $row['tag']; //liehuo.net $row['tag'] = htmlspecialchars($row['tag']); $row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/"; $row['highlight'] = 0; if($row['monthcc']>1000 || $row['weekcc']>300 ) { $row['highlight'] = mt_rand(3,4); } else if($row['count']>3000) { $row['highlight'] = mt_rand(5,6); } else { $row['highlight'] = mt_rand(1,2); } foreach($ctp->CTags as $tagid=>$ctag) { if(isset($row[$ctag->GetName()])) { $ctp->Assign($tagid,$row[$ctag->GetName()]); } } $revalue .= $ctp->GetResult(); } return $revalue; } ?> |
第二步:在你的列表模板中,引用如下tag标签即可。
{dede:tag sort='new' getall='0' row='4' typeid='6'}
<a href=[field:link/]>[field:tag /]</a>
{/dede:tag}
红色的地方一定要有,然后getall='0' 就可了。
上一篇 网站首页被k,请大家不要惊慌
下一篇 网页中空格的烦恼