|
帝国cms列表模板调用顶赞评论tag和此内容包含图片总数
如图:
列表内容模板(list.var)
顶的功能需要在模板里面加上
<script type="text/javascript" src="[!--news.url--]e/data/js/ajax.js"></script>
如下:
- $cl=$empire->fetch1("select classname from {$dbtbpre}enewsclass where classid='$r[classid]'");
- $classname=$cl['classname'];
- $fr=$empire->fetch1("select infotags,newstext from {$dbtbpre}ecms_news_data_{$r[stb]} where id='$r[id]'");
- $newstext=$fr['newstext'];
- $imgcount=substr_count($newstext,"<img");
- $infotags=$fr['infotags'];
- $r_tag=explode(",",$infotags);
- for($i=0;$i<count($r_tag);$i++){
- if($r_tag[$i]){
- $tagslink=$public_r[newsurl]."e/tags/?tagname=".urlencode($r_tag[$i]);
- $tags.="<a href='$tagslink' target='_blank' rel='tag'>".$r_tag[$i]."</a> / ";
- }
- }
- if($r[titlepic]!=''){
- $titlepic=' <p class="focus"><a target="_blank" href="[!--titleurl--]" class="thumbnail"><img data-original="'.sys_ResizeImg($r[titlepic],218,218,1).'" class="thumb"/></a></p>';
- $width='';
- }else{
- $titlepic='';
- $width='style="margin-right: 0px;"';
- }
- if($r[jiage]!=''){
- $small='<i class="red"> [!--jiage--]</i>';
- $goods='<span class="art-link"><a href="[!--news.url--]go.php?go='.base64_encode($r[goods]).'" target="_blank" class="btn-red">去看看 <em></em></a></span>';
- }else{
- $small='<small class="text-muted"><span class="glyphicon glyphicon-picture"></span>'.$imgcount.'</small>';
- $goods='';
- }
- $listtemp='<article class="excerpt excerpt-one">
- <header><a class="cat label label-important" href="[!--this.classlink--]">'.$classname.'<i class="label-arrow"></i></a>
- <h2><a target="_blank" href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a></h2>
- '.$small.'</header>
- <p class="text-muted time">[!--username--] 发布于 [!--newstime--]</p>
- '.$titlepic.'
- <p class="note" '.$width.'>[!--smalltext--]</p>
- <p class="text-muted views"><span class="post-views">阅读(<script src=[!--news.url--]e/public/ViewClick/?classid=[!--classid--]&id=[!--id--]></script>)</span><span class="post-comments">评论(<span>[!--plnum--]</span>)</span><a href="JavaScript:makeRequest('."'[!--news.url--]e/public/digg?classid=[!--classid--]&id=[!--id--]&dotop=1&doajax=1&ajaxarea=diggnum[!--id--]'".','."'EchoReturnedText'".','."'GET'".','."''".');" class="post-like"><i class="glyphicon glyphicon-thumbs-up"></i>赞 (<span id="diggnum[!--id--]"><script src=[!--news.url--]e/public/ViewClick/?classid=[!--classid--]&id=[!--id--]&down=5></script></span>)</a><span class="post-tags">标签:'.rtrim($tags,' / ').'</span>'.$goods.'</p>
- </article>';
复制代码
|
上一篇:帝国cms 列表页内容模板调用文章正文字段下一篇:帝国cms调用顶赞最多的内容排序
|