帝国CMS模板如何调用指定栏目中的TAG或者当前栏目中TAG标签

青山 2021-10-2212:00:59
评论
1639字

帝国CMS模板制作中需要调用指定栏目中所有数据包含的TAG或者当前栏目中所有数据包含的TAG,该如何调用呢?下面给大家介绍四种方法可以实现:

帝国CMS模板如何调用指定栏目中的TAG或者当前栏目中TAG标签

方法1:

  1. [e:loop={"select DISTINCT([!db.pre!]enewstags.tagname),[!db.pre!]enewstags.tagid,[!db.pre!]enewstags.num from [!db.pre!]enewstags inner join [!db.pre!]enewstagsdata on [!db.pre!]enewstags.tagid = [!db.pre!]enewstagsdata.tagid where [!db.pre!]enewstagsdata.classid = 34 order by [!db.pre!]enewstags.num DESC limit 30",0,24}]
  2. <a href='<?=$public_r['newsurl']?>e/tags/?tagname=<?=$bqr['tagname']?>' title='<?=$bqr['num']?>个'><?=$bqr['tagname']?>(<?=$bqr['num']?>)</a>
  3. [/e:loop]

方法2(和上面的相同,只是sql格式有稍微不同):

  1. [e:loop={"select a.tagname,a.num,b.tagid from [!db.pre!]enewstags a,[!db.pre!]enewstagsdata b where a.tagid=b.tagid and classid=34 group by tagid order by num desc  limit 40",40,24,0}]
  2. <a href='<?=$public_r['newsurl']?>e/tags/?tagname=<?=$bqr['tagname']?>' title='<?=$bqr['num']?>个'><?=$bqr['tagname']?>(<?=$bqr['num']?>)</a>
  3. [/e:loop]

方法3:

  1. [e:loop={"select a.*,b.* from [!db.pre!]enewstags a,[!db.pre!]enewstagsdata b where a.tagid=b.tagid and classid=34 group by b.tagid order by a.num desc  limit 40",40,24,0}]
  2. <a href='<?=$public_r['newsurl']?>e/tags/?tagname=<?=$bqr['tagname']?>' title='<?=$bqr['num']?>个'><?=$bqr['tagname']?>(<?=$bqr['num']?>)</a>
  3. [/e:loop]

方法4:

  1. [e:loop={"select a.*,b.* from [!db.pre!]enewstags a LEFT JOIN [!db.pre!]enewstagsdata b ON a.tagid=b.tagid where classid=34 group by b.tagid order by a.num desc limit 100",0,24,0}]
  2. <a href='<?=$public_r['newsurl']?>e/tags/?tagname=<?=$bqr['tagname']?>' title='<?=$bqr['num']?>个'><?=$bqr['tagname']?>(<?=$bqr['num']?>)</a>
  3. [/e:loop]

注释:classid = 34 为栏目ID(国内新闻ID)必须为终极栏目
1、上面的为调用单个栏目
2、多个栏目时,修改“classid = 34”为 classid in(34,35,36,37)
3、调用当前栏目(列表、内容通用):把 “ classid = 34 ”  替换为  “ classid='$GLOBALS[navclassid]' ”

匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: