国内外主机
测评及优惠码

织梦模板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″}
问:[field:title function=cn_substr(@me,46)/]

答:[field:content function=cn_substr(html2text(@me),40)/],…详情>>


{/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″}
问:[field:title function=cn_substr(@me,46)/]

答:[field:content function=cn_substr(html2text(@me),40)/],…详情>>


{/dede:sql}

赞(0)
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《织梦模板DEDECMS的首页调用问答模块内容的教程》
文章链接:https://www.ibytx.com/449.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

© 2010-2025   博悦天下   本站主题由 themebetter 提供   网站地图 蒙ICP备2022003014号-9

本站不销售、不代购、不提供任何支持,仅分享网络信息,请自行辨别,请遵纪守法、文明上网

蒙公网安备 15010502000974号

请求次数:97 次,加载用时:1.158 秒,内存占用:62.67 MB

登录

找回密码

注册