您当前的位置:首页 > 计算机 > 服务器 > 万维网站 > 帝国cms

帝国cms如何调用带链接的关键字词

时间:01-28来源:作者:点击数:

在帝国建站程序中,如何调用带链接的关键字词?比如说:直接用变量[!--class.keywords--]调用,显示结果显示“SEO优化,网络营销,SEM学习,自媒体营销,SEO博客,营销思维”。

帝国cms如何调用带链接的关键字词?

一起来学习学习吧、具体操作如下:

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

按逗号分离字符串

  1. <?php
  2. $source = "SEO优化,网络营销,SEM学习,自媒体营销,SEO博客,营销思维";//按逗号分离字符串
  3. $hello = explode(',',$source);
  4. for($index=0;$index<count($hello);$index++)
  5. {
  6. echo "<li>"; echo $hello[$index];echo "</li>";
  7. }
  8. ?>

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

  1. <?php
  2. $cr=$empire->fetch1("select classpagekey from {$dbtbpre}enewsclass where classid='$GLOBALS[navclassid]'");
  3. $source=$cr[classpagekey];
  4. $hello = explode(',',$source);
  5. for($index=0;$index<count($hello);$index++)
  6. {
  7. echo "<li>"; echo $hello[$index];echo "</li>";
  8. }
  9. ?>

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

  1. <?php
  2. $cr=$empire->fetch1("select classpagekey from {$dbtbpre}enewsclass where classid='$GLOBALS[navclassid]'");
  3. $source=$cr[classpagekey];
  4. $hello = explode(',',$source);
  5. for($index=0;$index<count($hello);$index++)
  6. {
  7. echo "<li><a href='/e/tags/?tagname=$hello[$index]&tempid=8'>"; echo $hello[$index];echo "</a></li>";
  8. }
  9. ?>

怎么样,操作起来也是不是特别的简单,你也赶快去试试吧!

方便获取更多学习、工作、生活信息请关注本站微信公众号城东书院 微信服务号城东书院 微信订阅号
推荐内容
相关内容
栏目更新
栏目热门