帝国cms如何增加标签模板

帝国CMS教程 2022-06-21 23:51:27 368

帝国CMS标签模板是万能标签调用中不可忽视的重要组成,那么标签模板是如何增加的呢

1.标签模板增加路径

路径:后台--模板--标签模板--管理标签模板--增加标签模板

2.页面模板内容

[!--empirenews.listtemp--]

<!--list.var1-->

[!--empirenews.listtemp--]

3.列表内容模板(list.var) (*)

这里我是以标题图片判断,也就是如果有标题图片则显示标题图片样式,没有标题图片,则是没有标题图片样式,如图

这是代码部分,其中,我省略了标签的调用,主要过滤白嫖党,同时加入一级置顶优先显示istop

$titlepic='';
if($r[istop]==1){
$istop='【置顶】';
}
else{
$istop='';
}
if(empty($r[titlepic])){
$titlepic='<h2 class="title"><b>'.$istop.'</b><a href="[!--titleurl--]">[!--oldtitle--]</a></h2>
<p class="smalltext">[!--smalltext--]...</p>
<p class="extra-info"><span>【'.date("Y-m-d",$r[newstime]).'】</span><a href="[!--titleurl--]" class="goto">全文阅读</a></p>';
}

if($r[titlepic]){
$titlepic='<h2 class="title"><b>'.$istop.'</b><a href="[!--titleurl--]">[!--oldtitle--]</a></h2><span class="thumbnail imgscale"><a href="[!--titleurl--]"><img src="[!--titlepic--]" alt="[!--oldtitle--]"
            title="[!--oldtitle--]" style="max-width: 100%; height: auto;" /></a></span>

    <p class="smalltext">[!--smalltext--]...</p>
    <p class="extra-info"><span>【'.date("Y-m-d",$r[newstime]).'】</span><a href="[!--titleurl--]" class="goto">全文阅读</a></p>
';
}
$listtemp='<li>'.$titlepic.'</li>';

 

声明:资源来自网络转载,版权归原作者所有,与本站立场无关,如不慎侵犯了你的权益,请联系我们告知,将做删除处理!

原文地址:《帝国cms如何增加标签模板》发布于2022-06-21 23:51:27