帝国CMS首页灵动标签调用对应文章的tags方法,直接看代码 对应修改成自己的;注意数据表;

[e:loop={4,8,0,1}]  
<?php
$tsql=$empire->query("select * from www_zzxiu_com_ecms_jp_data_1 where id='$bqr[id]'");
while($tr=$empire->fetch($tsql)){
$a="$tr[infotags]";
$str=str_replace(',', ',', $a);
$tag='';
$t= explode(",", $str);
for($i=0;$i<count($t);$i++)
{
        if($t[$i])
        {
        
            $tsql=$empire->query("SELECT * FROM www_zzxiu_com_enewstags WHERE tagname = '".$t[$i]."'");
            while($trs=$empire->fetch($tsql)){
                $tagid=$trs[tagid];
            }
        
               $tagslink="/tag/".$tagid."/";
               $tag.="<a href='$tagslink' target='_blank' rel='category'><i class='dot'></i>".$t[$i]."</a>";
               
        }
}} 
?>  
<div class="col-6 col-sm-6 col-md-4 col-lg-3">
    <article class="post post-grid type-post hentry hasintro" data-aos="zoom-in">
        <div class="entry-media">
            <div class="placeholder" style="padding-bottom: 66.666666666667%;">
                <a href="<?=$bqsr['titleurl']?>" target="_blank">
                                        <img class="lazyload" data-src="<?=$bqr['titlepic']?>" alt="<?=$bqr['title']?>">
                                    </a>
            </div>
                    </div>
        <div class="entry-wrapper">
            <header class="entry-header">
                <h2 class="entry-title"><a href="<?=$bqsr['titleurl']?>" title="<?=$bqr['title']?>" target="_blank" rel="bookmark"><?=$bqr['title']?></a></h2> 
                <div class="entry-meta">
                    <span class="meta-category">
                                                                        <?=$tag?>
                                                                    </span>
                </div>
            </header>
                        <div class="entry-excerpt u-text-format"> <?=esub($bqr[smalltext],100)?></div>
                        <div class="entry-footer">
                <a href="<?=$bqsr['titleurl']?>" target="_blank"><time datetime="<?=date('Y-m-d H:i:s',$bqr[newstime])?>"><i class="fa fa-clock-o"></i> <?=date('Y-m-d H:i:s',$bqr[newstime])?></time></a>
               
                
       </div>
        </div>
    </article>
</div>
[/e:loop]


声明:有的资源均来自网络转载,版权归原作者所有,如有侵犯到您的权益 请联系邮箱:312334557@qq.com 我们将配合处理!

原文地址:《帝国cms首页调用对应文章的tags方法》发布于2020-07-02 20:48:14