帝国cms超级TAG管理-TAG调用说明-调用多个TAG

时间:2023年06月25日

/

来源:网络

/

编辑:佚名

调用多个TAG
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=""><?=$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?>"><?=$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?>"><?=$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?>"><?=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?>"><?=$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?>"><?=$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?>"><?=$tr['tagname']?></a>(<?=$tr['num']?>)</li>
        <?
        }
        ?>
            </ul>
      </div>
    <?
    }
}
?>
猜你需要

豫ICP备2021026617号-1  豫公网安备:41172602000185   Copyright © 2021-2028 www.78moban.com/ All Rights Reserved

本站作品均来自互联网,转载目的在于传递更多信息,并不代表本站赞同其观点和对其真实性负责。如有侵犯您的版权,请联系 1565229909#qq.com(把#改成@),我们将立即处理。