星联网络专注帝国CMS二次功能插件开发-精品网站模板站长代码素材

  • 最近更新
  • 模板:33
  • 记录:12640|
  • 插件:52|
  • 工具:4|
  • 代码:8|
  • 评论:0

DEDECMS的首页调用问答模块内容

前言

本文主要讲解《DEDECMS的首页调用问答模块内容》的详细内容

利用SQL来实现,以下是我的源码,要根据你的数据库表名自行改动:


{dede:sql sql="select as_ask.id,as_ask.title,as_askanswer.content from as_ask LEFT JOIN as_askanswer on as_ask.id=as_askanswer.askid where as_askanswer.ifanswer=1 and as_askanswer.ifcheck=1 or as_ask.bestanswer=as_askanswer.id order by as_ask.id desc LIMIT 0,1"}<br /><strong>问:</srtong><a href="/ask/question.php?id=[field:id/]" class="link3">[field:title function=cn_substr(@me,46)/]</a><br /><p><strong>答:</srtong>[field:content function=cn_substr(html2text(@me),40)/],...<a href="/ask/question.php?id=[field:id/]" class="link2">详情>></a></p><br />{/dede:sql}

放在首页任意位置调用就可以了。
里面调用条数,长度,可以根据自己的需求进行调整 。

可在在全局标记测试效果。

如果需要分栏目调用,那么加入as_ask.tid2=XX,如我的整形栏目为as_ask.tid2=7,调用如下:

{dede:sql sql="select as_ask.id,as_ask.title,as_askanswer.content from as_ask LEFT JOIN as_askanswer on as_ask.id=as_askanswer.askid and as_ask.tid2=7 where as_askanswer.ifanswer=1 and as_askanswer.ifcheck=1 or as_ask.bestanswer=as_askanswer.id order by as_ask.id desc LIMIT 0,1"}<br /><strong>问:</srtong><a href="/ask/question.php?id=[field:id/]" class="link3">[field:title function=cn_substr(@me,46)/]</a><br /><p><strong>答:</srtong>[field:content function=cn_substr(html2text(@me),40)/],...<a href="/ask/question.php?id=[field:id/]" class="link2">详情>></a></p><br />{/dede:sql}

本网刊登的文章均仅代表作者个人观点,并不代表本网立场。文中的论述和观点,敬请读者注意判断。

本文地址:http://www.xlkjgs.com/notes/web/11512.html

以上内容由本站整理呈现,请务必在转载分享时注明本文地址!如对内容有疑问,请联系我们,谢谢!

星联网络

星联网络是中国最具实战的互联网创业者的知识服务商,这里有互联网行业动态,网络推广,SEO优化,SEM优化,ESC配置,行业经验分型,互联网项目,微信营销、淘宝客赚钱、新媒体营销、京东运营、跨境电商等众多互联网营销知识分享

站长运营站长必备网站运营之道才能长久发展