按照官方的參考文章 [field:id function='GetTags(@me)' /] 可以在文章列表頁調用文章的TAG詞。
且調用出來的都是沒有超鏈接的文字。于是修改include/helpers/archive.helper.php中GetTags函數,
$tags .= ($tags==” ? “”.$row['tag'].”" : ‘,’.”".$row['tag'].”");
為此成功添加了標簽。不過由于GetTags函數在全局范圍中引用的比較頻繁,添加之后會造成編輯文章的時候TAG字段出現html代碼。
因此,在include/helpers/archive.helper.php 中新建GetTags_list函數,
function GetTags_list($aid)
{
global $dsql;
$tags = ”;
$query = “SELECT tag FROM `dede_taglist` WHERE aid=’$aid’ “;
$dsql->Execute(‘tag’,$query);
while($row = $dsql->GetArray(‘tag’))
{
$tags .= ($tags==” ? “<a href=http://item.feedsky.com/~feedsky/simplc/~8543723/694360388/5696268/1/’/tags.php?/”.urlencode($row['tag']).”‘>”.$row['tag'].”</a>” : ‘,’.”<a href=http://item.feedsky.com/~feedsky/simplc/~8543723/694360388/5696268/1/’/tags.php?/”.urlencode($row['tag']).”‘>”.$row['tag'].”</a>”);
}
return $tags;
}
在列表頁模板使用[field:id function='GetTags_list(@me)' /] 調用。
按照以上方法就可以得到效果。
此文由 網站目錄_網站網址收錄與提交入口 編輯,未經允許不得轉載!: