帝国cms的文章tags标签当做keywords关键字使用调用
需求:每篇文章都有自己的tags,现在需要将每篇文章的keywords关键字位置调用该文章的tags标签,
<?
$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");
$tag.=$t[$i].",";
}
}
?>
调用:
<meta name="keywords" content="<?php echo $tag; ?>"/>
效果如下图: