织梦调用discuz X2(指定板块)最新帖子的方法
发布时间:2020-12-14 05:04:54 所属栏目:Dedecms 来源:网络整理
导读:第一种方法: {dede:sql sql="select * from? ultrax.pre_forum_ ? thread where fid=37 limit 0,10"} [field:subject function="cn_substr('@me',60)" /] [field:lastpost function="date('m-d H:M','@me')" /] {/dede:sql} ultrax.pre_forum_ ? thread 为
第一种方法:
{dede:sql sql="select * from?ultrax.pre_forum_?thread where fid=37 limit 0,10"}
[field:subject function="cn_substr('@me',60)" /] [field:lastpost function="date('m-d H:M','@me')" /]
{/dede:sql}
ultrax.pre_forum_?thread为数据库和表名。
Fid是板块的id。
第二种方法:
1.?网上的教程都是针对?Dz7.0,?dx1.0 dx1.5 dx2.0?数据表名已 经变化,所以table="cdb_threads"要改成table="pre_forum_thread"。
2.?一般论坛都安装在BBS子目录下,所以引用的地址应改为:
?????????&n bsp;????如果是discuz?动态论坛,href="[field:global.cfg_cmspath/]/bbs/viewthread.php? tid=[field:tid /]”
如果是discuz?静态论坛,href="[field:global.cfg_cmspath/]/bbs/thread-[field:tid /]-1-1.html"
???????说明:[field:global.cfg_cmspath/]?为dede安装目录,你也可以使用绝对路 径,如:
href=你 的网站/bbs/thread-[field:tid /]-1-1.html
1. dede调用?Dx1.0之后,包括?dx1.5,?dx2.0?静态论坛最新主题 的方法:(伪静态)
?? {dede:loop table="pre_forum_thread" if="displayorder!=- 1" sort="tid" row="10"}
2、论坛指定版块帖子调用方法: (伪静态)
{ dede:loop table=“pre_forum_thread” if="fid=1 or fid=2 and displayorder!=-1" sort="tid" row="6" }?
· [field:subject function="cn_substr(' @ me',50)" /]
{ /dede:loop }?
其中的fid=1 or fid=2是论坛主题分类id,可以按照自己要求来修改,如 果是一个分类就直接写fid=x
3、论坛调精华主题调用代码如下 :(伪静态)
{dede:loop table=“pre_forum_thread” if="displayorder!=-1" sort="tid" row="10"}
· [field:subject function="cn_substr('@me',30)" /] ([field:lastpost function="date('m-d H:M','@me')" /])
{/dede:loop}?
4.?如果想调用某个板块的精华主题 代码如下:(伪静态)
{dede:loop table=“pre_forum_thread” if="fid=5 and displayorder!= -1" sort="tid" row="10"}
[field:subject function="cn_substr('@me',30)" /]([field:lastpost function="date('m-d H:M','@me')" /])
{/dede:loop}?
其中的fid=5是论坛主题分类id,可以按照自己要求来修改,?
如果想调用论坛所有 的板块的最新精华主题只要去掉fid=5 and?就可以了。
4、调用的帖子列表这可以按查看 次数排序,(伪静态)
{dede:loop table=“pre_forum_thread” sort="views" row="10"}
· [field:subject function="cn_substr('@me','@me')" /])
{/dede:loop}?
其中sort="views"?就是控制按照查看 次数排序的代码
5、论坛置顶版块帖子调用方法举 例:(伪静态)
{ dede:loop table=“pre_forum_thread” sort="dateline" if="fid='3' and typeid='51'" row="10" }
· [field:subject function="cn_substr(' @ me',30)" /]
{ /dede:loop }
论坛最新主题调用:
{dede:loop table="?pre_forum_thread?" sort="tid" row="10"}
· [field:subject function="cn_substr('@me','@me')" /])
{/dede:loop}
调用特定板块的主题
{dede:loop table="?pre_forum_thread" if="fid=5 and displayorder!=-1" sort="tid" row="10"}
·[field:subject function="cn_substr('@me','@me')" /])
调用论坛指定板块精 华帖。
?"?if="fid=5 AND digest>0 and displayorder!=-1 "?sort="tid" row="10"}
调用论坛指定板块精 华帖(按查看次 数排序):
论坛最新主题:?
{dede:loop table="?pre_forum_thread?" if="fid=5 and displayorder!=- 1"?sort="views"?row="10"}
· [field:subject function="cn_substr('@me','@me')" /])
{/dede:loop}
以往的方法都是针对Dz7.0,dx1.0 dx1.5 dx2.0?数据表名已经变化,所以table="cdb_threads"要改成table="pre_forum_thread"。
? ?? ?? ?2.?开启了伪静态论坛与动态论坛引用地址 是不一样的。假设论坛安装在BBS子目录下,那么引用的地址应改为:
? ?? ????discuz静态论坛,href="[field:global.cfg_cmspath/]/bbs/thread-[field:tid /]-1-1.html"
? ?? ?? ?discuz动态论坛href="[field:global.cfg_cmspath/]/bbs/viewthread.php?tid=[field:tid /]”
? ?? ????说明:?[field:global.cfg_cmspath/]为dede安装目录,你也可以使用绝对路径,如:
? ?? ?? ?? ?? ?? ?? ? href=http://www.dede58.com/bbs/thread-[field:tid /]-1 -1.html
? ?? ?? ?? ?? ?? ?? ? href=http://www.dede58.com/thread-[field:tid /]-1- 1.html??(开启bbs为子域名)
?
结合网上关于dede调用dz7.0以前的教程,得出dede调用?dx静态论坛最新方法:
?
1. dede调用??Dx1.0之后,包括dx1.5,dx2.0?静态论坛最新主题的方法 :(伪静态)
1.?????{dede:loop table="pre_forum_thread" sort="tid" row="10"} 2.??????我调用的是最新发布的帖子。调用代码如下:
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |