首页 > CMS教程 > 帝国CMS    日期:2020-02-21 / 来自互联网 / 浏览

直接用变量[!--class.keywords--]调用,显示结果显示“网站建设,企业网站,公司网站建设,网站建设报价,网站建设公司”

<?php
$cr=$empire->fetch1("select classpagekey from {$dbtbpre}enewsclass where classid='$GLOBALS[navclassid]'");
echo $cr[classpagekey];
?>

按逗号分离字符串

<?php 
$source = "网站建设,企业网站,公司网站建设,网站建设报价,网站建设公司";//按逗号分离字符串 
$hello = explode(',',$source); 
for($index=0;$index<count($hello);$index++) 
{ 
echo "<li>"; echo $hello[$index];echo "</li>"; 
} 
?>

最后,在帝国cms,再结合sql查询语句

<?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>"; echo $hello[$index];echo "</li>"; 
} 
?>

链接同步tags标签,如果没有建立标签,就需要到后台手动建立tags,然后系统自动匹配

<?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 3 4 5