帝国CMS 内容页如何调用tag标签伪静态 url教程
调用标签:
<?php $ecms_bq_sql=sys_ReturnEcmsLoopBq("select * from [!db.pre!]enewstags ORDER BY num DESC limit 100",14,24,0); $bqno=0; while($bqr=$empire->fetch($ecms_bq_sql)) { $bqsr=sys_ReturnEcmsLoopStext($bqr); $bqno++; ?> <div class="body-flex-wrap_item"> <a href="/tag/<?=$bqr[tagid]?>.html" target="_blank"><?=$bqr[tagname]?></a> </div> <?php } ?>
内容标签:
<?php $tbname=$class_r[$navinfor['classid']]['tbname']; $ftbname=$dbtbpre."ecms_".$tbname."_data_".$navinfor['stb']; $hlt = $empire->fetch1("select infotags from {$ftbname} where id='$navinfor[id]'"); $a=$hlt[infotags]; $str=str_replace(',', ',', $a); $tag=''; $t= explode(",", $str); for($i=0;$i<count($t);$i++) { if($t[$i]) { $datar=$empire->fetch1("select tagid from {$dbtbpre}enewstags where tagname='$t[$i]' limit 1"); $tagslink="/tag/".$datar[tagid].".html"; echo '<li><a href="'.$tagslink.'" >'.$t[$i].'</a></li>'; } } ?>
伪静态规则:
rewrite '^/tag/([a-zA-Z0-9]+).html$' /e/tags/?tagid=$1 last;
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。