//获得某文档的所有tag
function GetTags($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=/tags.php?/{$row['tag']}target=_blank>{$row['tag']}</a>" : ','."<ahref=/tags.php?/{$row['tag']}target=_blank>{$row['tag']}</a>");
}
return $tags;
}
在列表页的列表里调用TAG代码如下
[field:id runphp=yes]
$tsql = new DedeSql(false);
$tags = '';
$tsql->SetQuery("Select i.tag From dede_taglist t left join dede_tagindex i on i.id=t.tid where t.aid='@me'");
$tsql->Execute('t');
while($row = $tsql->GetArray('t',MYSQL_ASSOC)){
$tags .= "<a href='/tags.php?/".urlencode($row['tag'])."'>".$row['tag']."</a>";