帝国CMS用灵动标签调用tag的最详细教程

分类栏目:帝国学院

发布于



第一种 普通灵动标签调用

1、 用名称的调用 tagname=<?=$bqr['tagname']?>

[e:loop={"select * from [!db.pre!]enewstags order by tagid",0,24,0}]        
<a href='<?=$public_r[newsurl]?>e/tags/?tagname=<?=$bqr['tagname']?>' class='tag-link-<?=$bqr['tagid']?>' title='<?=$bqr[num]?>个话题' style='font-size: 9pt;' target="_blank"><?=$bqr['tagname']?>(<?=$bqr[num]?>)</a>
[/e:loop]



[e:loop={"select * from [!db.pre!]enewstags order by num DESC limit 20",0,24,0}]
    <?
echo '<a href="/e/tags/?tagname='.urlencode($bqr['tagname']).'"  target="_blank" title="'.$bqr['num'].'个话题" >'.$bqr['tagname'].'('.$bqr['num'].')</a>';
?>
    [/e:loop]


注释:[e:loop={"select * from [!db.pre!]enewstags order by tagid",0,24,0}]  sal查询tag

      <?=$public_r[newsurl]?>e/tags/?tagname=<?=$bqr['tagname']?> 即 http://127.0.0.1/e/tag/?tagname=tag名称
      
      <?=$bqr['tagid']?> tag的id

      <?=$bqr[num]?>  如:关于“美女”的tag词有多少个,即统计tag相关数
 
      <?=$bqr['tagname']?>  tag名称:如“美女”


2 用id的调用 tagid=<?=$bqr['tagid']?>  注释:不能用--用tagid做url地址不行

[e:loop={"select * from [!db.pre!]enewstags order by tagid",0,24,0}]
<li><a href="/e/tags/?tagid=<?=$bqr['tagid']?>"  target="_blank"><?=$bqr['tagname']?></a></li>
[/e:loop]

第二种 灵动标签+php输出式

[e:loop={"select * from [!db.pre!]enewstags order by num DESC limit 20",0,24,0}]
    <?
echo '<a href="<?=$public_r[newsurl]?>e/tags/?tagname='.urlencode($bqr['tagname']).'"  target="_blank" title="'.$bqr['num'].'个话题" >'.$bqr['tagname'].'('.$bqr['num'].')</a>';
?>
    [/e:loop]

------------------------------------------------------------------------------------------

注意:如果想调用几条 添加limit 20 调用20条
如:
1、按ID调用(新的靠前)
[e:loop={"select * from [!db.pre!]enewstags order by tagid limit 20",45,24,0}]     tagid后加limit 20

2、按数量调用(信息数多的靠前)
[e:loop={"select * from [!db.pre!]enewstags order by num DESC limit 20",0,24,0}]  num DESC后加limit 20
 

查看原内容