1、调用最新10个tag
<?
$tsql=$empire->query("select * from {$dbtbpre}enewstags order by tagid desc limit 10");
while($tr=$empire->fetch($tsql)){
$tagurl=dp_itagLink($tr['tagid']);
?>
<li><a href="" rel="external nofollow" ><?=$tr['tagname']?></a>(<?=$tr['num']?>)</li>
<?}?>
2、按分类调用TAG
<?
$tcsql=$empire->query("select * from {$dbtbpre}enewstagsclass where classid>0 order by classid desc");
while($tcr=$empire->fetch($tcsql)){
$tagclassurl=dp_itagClassLink($tcr['classid']);
?>
<div class="showtag">
<h3><a href="<?=$tagclassurl?>" rel="external nofollow" rel="external nofollow" ><?=$tcr['classname']?></a></h3>
<ul>
<?
$tsql=$empire->query("select * from {$dbtbpre}enewstags where cid=".$tcr['classid']." order by tagid desc limit 10");
while($tr=$empire->fetch($tsql)){
$tagurl=dp_itagLink($tr['tagid']);
?>
<li><a href="<?=$tagurl?>" rel="external nofollow" rel="external nofollow" rel="external nofollow" ><?=$tr['tagname']?></a>(<?=$tr['num']?>)</li>
<?
}
?>
</ul>
</div>
<?
}
?>
3、按照tag拼音字母顺序调用
<?php
$zm_r=array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
?>
<div class="zmlist">
字母:
<?
foreach($zm_r as $zm){
?>
<a href="#<?=$zm?>" rel="external nofollow" ><?=strtoupper($zm)?></a>
<?
}
?>
</div>
<div class="taglist">
<?
foreach($zm_r as $zm){
?>
<h3><a name="<?=$zm?>"><?=strtoupper($zm)?></a></h3>
<ul>
<?
$zsql=$empire->query("select tagid from {$dbtbpre}dp_tagsadd where py like '".$zm."%' order by tagid desc");
while($zr=$empire->fetch($zsql)){
$t=$empire->fetch1("select * from {$dbtbpre}enewstags where tagid='$zr[tagid]' limit 1");
$tagurl=dp_itagLink($zr[tagid]);
?>
<li><a href="<?=$tagurl?>" rel="external nofollow" rel="external nofollow" rel="external nofollow" ><?=$t['tagname']?></a></li>
<?
}
?>
</ul>
<?
}
?>
</div>
4、在栏目页模板,根据tag分类绑定的栏目,调用此栏目下的TAG
<?php
$bdsql=$empire->query("select * from {$dbtbpre}dp_itag_class where modid='$navclassid'");
while($bdr=$empire->fetch($bdsql)){
$cid=$bdr['classid'];
$tcsql=$empire->query("select * from {$dbtbpre}enewstagsclass where classid='$cid' order by classid desc");
while($tcr=$empire->fetch($tcsql)){
$tagclassurl=dp_itagClassLink($tcr['classid']);
?>
<div class="showtag">
<h3><a href="<?=$tagclassurl?>" rel="external nofollow" rel="external nofollow" ><?=$tcr['classname']?></a></h3>
<ul>
<?
$tsql=$empire->query("select * from {$dbtbpre}enewstags where cid=".$tcr['classid']." order by tagid desc limit 10");
while($tr=$empire->fetch($tsql)){
$tagurl=dp_itagLink($tr['tagid']);
?>
<li><a href="<?=$tagurl?>" rel="external nofollow" rel="external nofollow" rel="external nofollow" ><?=$tr['tagname']?></a>(<?=$tr['num']?>)</li>
<?
}
?>
</ul>
</div>
<?
}
}
?>