帝国cms列表页调用关键字ags标签
关键字tags
注意: 一定要勾选“使用程序代码”
方法一:
代码如下:
$nsmalltext=$r[smalltext];
$ntext=strip_tags($nsmalltext);//去除内容简介里的HTML标签
$newtext=esub($ntext,100,’…’) ;//限制100字
$keyboard=$r[keyboard];
$r_tag=explode(“,”,$keyboard);
$tempid=1;//这里是搜索模板ID
for($i=0;$i<count($r_tag);$i++)
{
if($r_tag[$i])
{
$tagslink=$public_r[newsurl].”e/search/?searchget=1&tbname=$tbname&tempid=$tempid&show=keyboard&keyboard=”.$r_tag[$i];//链接
$tags.=”<a href=’$tagslink’ target=’_blank’>”.$r_tag[$i].”</a> “;
}
}
$listtemp='<div class=””>
<h3 class=””>
<a href=”[!–titleurl–]” target=”_blank” title=”[!–oldtitle–]”>[!–title–]</a></h3>
<p title=”内容简介”>’.$newtext.’…</p>
<p class=””><span>标签:</span>’.$tags.'<span class=””>[!–newstime–]</span>
</p>
</div>’;
方法二:
代码如下:
$classid=$r[classid]; //获取栏目id
$tbname=$class_r[$classid][tbname];//获取数据表
$fr=$empire->fetch1(“select infotags from {$dbtbpre}ecms_”.$tbname.”_data_{$r[stb]} where id=’$r[id]'”);//查询副表下的infotags字段
$tag1=”.$fr[infotags].”;
$r_tag=explode(“,”,$tag1);
for($i=0;$i<count($r_tag);$i++)
{
if($r_tag[$i])
{
$tagslink=$public_r[newsurl].”e/tags/?tagname=”.$r_tag[$i];//链接
$tags.=”<a href=’$tagslink’ target=’_blank’>”.$r_tag[$i].”</a> “;
}
}
if(empty($fr[infotags]))
{
$tags=”无”;
}
$listtemp=’ <p><a class=”” href=”[!–titleurl–]” target=”_blank”>[!–title–]</a></p>
<p class=””> [!–smalltext–] <a href=”[!–titleurl–]”>[详细]</a></p>
<div class=””>标签:’.$tags.’
<p><span>[!–newstime–]</span><span><script src=[!–news.url–]e/public/ViewClick?classid=[!–classid–]&id=[!–id–]&addclick=1></script>人浏览</span><span>来自互联网</span></p></div>
‘;
方法三:
根据TAG id 的id 来调用关键字词
代码如下:
$tagstr=”;
$tsql=$empire->query(“select tagid from {$dbtbpre}enewstagsdata where id=’$r[id]’ and classid=’$r[classid]’ “);
while($tr=$empire->fetch($tsql)){
$tt=$empire->fetch1(“select * from {$dbtbpre}enewstags where tagid=”.$tr[‘tagid’].” limit 1″);
if(!$tt[‘tagid’]){
continue;
}else{
//tagname的动态 或 伪静态 时的链接,采用以下1行代码
//$tagslink=eReturnRewriteTagsUrl(0,$tt[‘tagname’],1);
//tagid式的动态链接,采用以下1行代码
$tagslink=$public_r[‘newsurl’].’e/tags/?tagid=’.$tt[‘tagid’].’&tempid=8′;
//$tagslink=user_HtmlTagLink($tt[‘tagid’]);
}
$tagstr.='<a title=”‘.$tagname.'” target=”_blank” href=”‘.$tagslink.'”>’.$tt[‘tagname’].'</a>’;
}
$listtemp=’
<li>
<section><a href=”[!–titleurl–]” class=”news-zuixin-pic”><img src=”[!–titlepic–]”></a>
<h2><a href=”[!–titleurl–]”>[!–title–]</a></h2>
<p>[!–smalltext–]</p>
<span>’.$tagstr.'</span></section>
</li>
‘;
评论(0)