织梦首页列表页调用当前文章带链接tag标签效果如下图所示:
打开 includeextend.func.php 在最下面加入
/**
?*? 首页/列表获取文章Tag
?*
?* @access? ? public
?* @param? ? ?string? $aid?? 文章id
?* @param? ? ?string? $num?? 数量
?* @return? ? string
?*/
if (!function_exists('GetMyTags'))
{
function GetMyTags($aid,$num=3)
{
global $dsql;
$tags = '';
$query = "Select tag From `dede_taglist` Where aid='$aid' limit $num ";
$dsql->Execute('tag',$query);
while($row = $dsql->GetArray('tag'))
{
$tags.= ($tags=='' ? "
}
return $tags;
}
}
?
前台模板调用方法
[field:id function=GetMyTags(@me,5)/]
数字5 是调用5个tag
?
?