导航
当前位置:网站首页 > 站长新闻 > CMS教程 > 织梦文章页每个tag标签单独输出相关文章

织梦文章页每个tag标签单独输出相关文章

作者:达特 日期:2023-05-06 分类:CMS教程

织梦文章页每个tag标签单独输出相关文章内容页模板标签写法:


01 {dede:tag row='30' sort='new' getall='0'}
02 <div class="hot mt1">
03 <dl class="tbox light">
04 <dt class='light'><strong>[field:tag /]</strong></dt>
05 <dd class='light'>
06 <ul class="c1 ico2">
07 [field:tag runphp=yes]
08 global $dsql,$aid;
09 $taga = @me;
10 $arow = $dsql->GetOne("Select * From `dede_tagindex` where tag like '$taga'");
11 $tid = $arow['id'];
12 if($tid!='')
13 {
14 $tagsql = "Select aid From `dede_taglist` where tid = $tid And arcrank > -1 group by aid order by aid desc";
15 $dsql->SetQuery($tagsql);
16 $dsql->Execute('t');
17 $result = '';
18 while($arow = $dsql->GetArray('t'))
19 {
20 $ids[] = $arow['aid'];
21 }
22 }
23 if(count($ids) > 0)
24 {
25 $idsStr = join(',', $ids);
26 $query = "Select arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule,
27 tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath
28 from `dede_archives` arc left join `dede_arctype` tp on arc.typeid=tp.id
29 where arc.arcrank>-1 and arc.id in($idsStr) And arc.id<>$aid order by arc.id desc limit 10";//输入多少个文章
30 }
31 $dsql->SetQuery($query);
32 $dsql->Execute('t');
33 $result = '';
34 $totalRow = $dsql->GetTotalRow();
35 while($row = $dsql->GetArray('t'))
36 {
37 $arcurl = GetOneArchive($row['id']);
38 $result .= "<li><a href="{$arcurl['arcurl']}">{$row['title']}</a></li>";
39 }
40 if($result=='') $result = "<p style='color:#f00;'>?该TAG标签没有相关文章</p>";
41 @me = $result;
42 [/field:tag]
43 </ul>
44 </dd>
45 </dl>
46 </div>
47 {/dede:tag}

猜你还喜欢