帝国CMS内容页怎么调用TAG标签、动态URL、伪静态URL?(帝国CMS调用tag标签、动态url和伪静态url的方法)
帝国CMS内容页怎么调用TAG标签、动态URL、伪静态URL?(帝国CMS调用tag标签、动态url和伪静态url的方法)
很多的朋友在使用帝国CMS程序的时候,会有很对的问题不知道如何解决,例如最近很多小伙伴经常问到国CMS内容页怎么调用TAG标签、动态URL、伪静态URL呢?今天帝国CMS模板网小编就针对这个问题,来简单的为大家分享一些实现方法,告诉大家帝国CMS调用tag标签、动态url和伪静态url的方法,下面就来跟帝国CMS模板小编一起来看看如何实现吧!
内容页调用tag,按tagname调用:
<div class="tagsline">Tags:<? $a="$navinfor[infotags]"; $str=str_replace(',', ',', $a); $tag=''; $t= explode(",", $str); for($i=0;$i<count($t);$i++) { if($t[$i]) { $tagslink="[!--news.url--]e/tags/?tagname=".urlencode($t[$i])."&tempid=1"; $tag.="<a href='$tagslink' target='_blank'>".$t[$i]."</a> "; } } echo $tag; ?> </div>
或,按tagname调用:
<?php $fr=$empire->fetch1("select infotags from {$dbtbpre}ecms_news_data_{$navinfor[stb]} where id='$navinfor[id]'"); $infotags=$fr['infotags'];//这个就是infotags字段内容 $tag=''; $t=explode(',',$infotags);//去逗号 $d=count($t); for($i=0;$i<count($t);$i++) { if($t[$i]) { $tagslink="[!--news.url--]e/tags/?tagname=".urlencode($t[$i])."&tempid=1"; $tag.="<a href='$tagslink' target='_blank'>".$t[$i]."</a> "; } } echo $tag; ?>
或,按id调用:
<? $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="[!--news.url--]e/tags/?tagid=".$datar[tagid].""; $tag.="<a href='$tagslink' target='_blank'>".$t[$i]."</a> "; } } echo $tag; ?>
注释:
限制数量,把$i
mid=1数据模型id tempid=1模型的模板id orderby排列方式 classid=34栏目id &line=5调用条数
如:上面的 &tempid=1
如果想用静态以ID的HTML 可以参考下面这个
<p >本文标签:<? $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=1;$i<count($t);$i++) { if($t[$i]) { $datar=$empire->fetch1("select tagid from {$dbtbpre}enewstags where tagname='$t[$i]' limit 1"); $tagslink="[!--news.url--]tag/".$datar[tagid].".html"; $tag.="<a href='$tagslink' style='color:red;font-size:14px' target='_blank'>".$t[$i]."</a> "; } } echo $tag; ?></p>
OK,教程到这里就结束了,是不是很简单呢?具体的大家自行去测试哈!
热门排行
-
帝国cms网站地图sitemap.xml的制作方法2022年03月07日88
-
帝国CMS信息提示页美化模板(分享一个帝2022年03月09日55
-
帝国CMS怎么提高网页打开速度?(帝国CMS提2022年04月06日54
-
帝国CMS内容模板获取所有分页数和当前2022年04月05日49
-
帝国cms列表页调用文章关键词与tag的方2022年03月07日46
-
帝国CMS列表页文章怎么升序降序排列文2022年03月11日46