织梦调用当前文章tag标签对应的文章列表方法
织梦调用当前文章tag标签对应的文章列表方法,看效果图:
调用代码:
{dede:tag row=’30’ sort=’new’ getall=’0′}
- [field:tag /]
-
- {$row[‘title’]}
[field:tag runphp=yes]
global $dsql,$aid;
$i = 1;
$taga = @me;
$arow = $dsql->GetOne(“Select * From `dede_tagindex` where tag like ‘$taga'”);
$tid = $arow[‘id’];
if($tid!=”)
{
$tagsql = “Select aid From `dede_taglist` where tid = $tid And arcrank > -1 group by aid order by aid desc”;
$dsql->SetQuery($tagsql);
$dsql->Execute(‘t’);
$result = ”;
while($arow = $dsql->GetArray(‘t’))
{
$ids[] = $arow[‘aid’];
}
}
if(count($ids) > 0)
{
$idsStr = join(‘,’, $ids);
$query = “Select arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule,
tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath
from `dede_archives` arc left join `dede_arctype` tp on arc.typeid=tp.id
where arc.arcrank>-1 and arc.id in($idsStr) And arc.id<>$aid order by arc.id desc”;
}
$dsql->SetQuery($query);
$dsql->Execute(‘t’);
$result = ”;
$totalRow = $dsql->GetTotalRow();
while($row = $dsql->GetArray(‘t’))
{
$arcurl = GetOneArchive($row[‘id’]);
$result .= “
“;
}
if($result==”) $result = “
该TAG标签没有相关文章
“;
@me = $result;
[/field:tag]
{/dede:tag}
请根据自己的文章列表样式来套用即可。
☉本站提供的源码、模板、软件工具等其他资源,都不包含技术服务,请大家谅解!
pbootcms模板网 » 织梦调用当前文章tag标签对应的文章列表方法