思路:
1,帝国CMS的关键字一般是用英文逗号分隔,比如:小红,小明,小华
2,需要把英文逗号去掉,并且给每个关键字用html标签包起来,比如:<li>小红</li><li>小明</li><li>小华</li>
代码:
<?php
$cr=$empire->fetch1("select classpagekey from {$dbtbpre}enewsclass where classid='$GLOBALS[navclassid]'");
$source=$cr[classpagekey];
$hello = explode(',',$source);
for($index=0;$index<count($hello);$index++)
{
echo "<li><a href='/e/tags/?tagname=$hello[$index]&tempid=8'>"; echo $hello[$index];echo "</a></li>";
}
?>
说明:
1,先把关键字内容取出来
2,用php的explode函数,把字符串打散为数组
3,然后用for循环,把数组中的每个词语用指定的HTML标签包起来
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(0)