织梦调用当前文章tag标签对应的文章列表方法,看效果图:
调用代码:
03
52
{/dede:tag}
-
04
- [field:tag /] 05
-
06
-
07
[field:tag runphp=yes]
08
global $dsql,$aid;
09
$i = 1;
10
$taga = @me;
11
$arow = $dsql->GetOne("Select * From `dede_tagindex` where tag like '$taga'");
12
$tid = $arow['id'];
13
if($tid!='')
14
{
15
$tagsql = "Select aid From `dede_taglist` where tid = $tid And arcrank > -1 group by aid order by aid desc";
16
$dsql->SetQuery($tagsql);
17
$dsql->Execute('t');
18
$result = '';
19
while($arow = $dsql->GetArray('t'))
20
{
21
$ids[] = $arow['aid'];
22
}
23
}
24
if(count($ids) > 0)
25
{
26
$idsStr = join(',', $ids);
27
28
$query = "Select arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule,
29
30
tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath
31
32
from `dede_archives` arc left join `dede_arctype` tp on arc.typeid=tp.id
33
34
where arc.arcrank>-1 and arc.id in($idsStr) And arc.id<>$aid order by arc.id desc";
35
}
36
$dsql->SetQuery($query);
37
$dsql->Execute('t');
38
$result = '';
39
$totalRow = $dsql->GetTotalRow();
40
while($row = $dsql->GetArray('t'))
41
{
42
$arcurl = GetOneArchive($row['id']);
43
$result .= "
- {$row['title']} "; 44 } 45 if($result=='') $result = "
该TAG标签没有相关文章
"; 46 @me = $result; 47 [/field:tag] 48
50
请根据自己的文章列表样式来套用即可。
标签: