调用Dedecms(织梦)调用discuzX2最新帖子的方法

discuzx2  时间:2021-03-20  阅读:()

Dedecms(织梦)调用dis cuzX2 指定板块最新帖子的方法

第一种方法

{dede:sql sql="select *from ultrax.pre_forum_thread where fid=37 l imit 0,10"}

<l i><a href="/bbs/forum.php?mod=viewthread&tid=[field:tid/]">

[field:subject function="cn_substr('@me' ,60)" /] [field: lastpost function="date('m-d H:M' , '@me')" /]</a></l i>{/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子目录下所以引用的地址应改为

如果是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"}<ahref="[field:global .cfg_cmspath/]/bbs/thread-[field:tid /]-1-1 .html">•[field:subject funct ion="cn_substr('@me' ,30)"/]</a><br/>{/dede: loop}

2、论坛指定版块帖子调用方法 伪静态

{dede: loop table=“pre_forum_thread” if="fid=1 or fid=2 and displayorder!=-1"sort="tid" row="6" }

<a href="[field:global .cfg_cmspath/]/bbs/thread-[field:tid/]-1-1 .html" target="_blank">

·[field:subject function="cn_substr('@me' ,50)" /]</a>

<br/>

{ /dede: loop}

其中的fid=1 orfid=2是论坛主题分类id可以按照自己要求来修改如果是一个分类就直接写fid=x

3、论坛调精华主题调用代码如下 伪静态

{dede: loop table=“pre_forum_thread” if="displayorder!=-1"sort="tid" row="10"}

<a href="[field:global .cfg_cmspath/]/bbs/thread-[field:tid/]-1-1 .html">

·[field:subject function="cn_substr('@me' ,30)" /]([field: lastpost function="date('m-d H:M' , '@me')" /])</a><br/>

{/dede: loop}

4.如果想调用某个板块的精华主题代码如下 伪静态

{dede: loop table=“pre_forum_thread” if="fid=5 and displayorder!=-1"sort="tid" row="10"}

<a href="[field:global .cfg_cmspath/]/bbs/thread-[field:tid/]-1-1 .html">

[field:subject function="cn_substr('@me' ,30)" /]([field: lastpost function="date('m-d H:M' , '@me')" /])</a><br/>

{/dede: loop}

其中的fid=5是论坛主题分类id可以按照自己要求来修改

如果想调用论坛所有的板块的最新精华主题只要去掉fid=5 and就可以了。

4、调用的帖子列表这可以按查看次数排序 伪静态

{dede: loop table=“pre_forum_thread”sort="views" row="10"}

<a href="[field:global .cfg_cmspath/]/bbs/viewthread.php?tid=[field:tid/]">

·[field:subject function="cn_substr('@me' ,30)" /]([field: lastpost function="date('m-d H:M' , '@me')" /])</a><br/>

{/dede: loop}

其中sort="views"就是控制按照查看次数排序的代码

5、论坛置顶版块帖子调用方法举例 伪静态

{dede: loop table=“pre_forum_thread”sort="dateline" if="fid='3'and typeid='51'" row="10" }

<a href="[field:global .cfg_cmspath/]/bbs/thread-[field:tid/]-1-1 .html" target="_blank">

·[field:subject function="cn_substr('@me' ,30)" /]</a><br>

{ /dede: loop}

论坛最新主题调用

{dede: loop table="pre_foru m_th read" sort="tid" row="10"}

<a h ref="/d z/v iewt h read.p h p?t id=[field:t id/]">

·[field:su bject fu nction="cn_su bstr('@me',30)" /]([field: lastpost fu nction="date('m-d H:M','@me')" /])</a>

<br/>

{/d ed e: lo o p}

调用特定板块的主题

{dede: looptable="pre_forum_thread" if="fid=5 and displayorder!=-1" sort="tid" row="10"}

<a href="/dz/viewthread.php?tid=[field:tid/]">

· [field:subje ct function="cn_substr('@me',30)"/]([field: lastpost funct ion="date('m-d H:M', '@me')"/])

</a>

<br/>

调用论坛指定板块精华帖。

{dede: loop table="pre_forum_thread" if="fid=5 AND digest>0 and displ ayorder!=-1 " sort="tid" row="10"}<a h ref="/d z/v iewt h read.p h p?t id=[field:t id/]">

·[field:su bject fu nction="cn_su bstr('@me',30)" /]([field: lastpost fu nction="date('m-d H:M','@me')" /])</a>

<br/>

调用论坛指定板块精华帖按查看次数排序

论坛最新主题 <br/>

{dede: loop table="pre_foru m_th read" if="fid=5 and d ispl ayorder!=-1" sort="views" row="10"}

<a h ref="/d z/v iewt h read.p h p?t id=[field:t id/]">

·[field:su bject fu nction="cn_su bstr('@me',30)" /]([field: lastpost fu nction="date('m-d H:M','@me')" /])</a>

<br/>

{/d ed e: lo o p}

以往的方法都是针对D z7.0 dx1.0 dx 1.5 dx2.0数据表名已经变化所以table="cd b_thread s"要改成table="pre_foru m_th rea d"。

2.开启了伪静态论坛与动态论坛引用地址是不一样的。假设论坛安装在BBS子目录下那么引用的地址应改为d isc uz静态论坛 h ref="[field:g lo ba l.cfg_c mspath/]/bbs/th rea d-[field :tid/]-1-1.htm l"d isc u z动态论坛 h ref="[field:g lo ba l.cfg_c m spath/]/b bs/v iewth read.p h p?tid=[field:tid/]”

说明 [field:globa l.cfg_cmspat h/]为dede安装目录你也可以使用绝对路径如h ref=http://www.h udongs.com/bbs/th read-[field:tid/]-1-1.htm lhref=http://bbs.hudongs.com/thread-[field:tid/]-1-1.html 开启bbs为子域名

结合网上关于dede调用dz7.0以前的教程得出dede调用dx静态论坛最新方法:

1.dede调用Dx1.0之后包括dx 1.5 dx2.0静态论坛最新主题的方法 伪静态

1. {dede:loop table="pre_forum_thread" sort="tid" row="10"}<ahref=" [field:global.cfg_cmspath/]/bbs/thread- [field:tid /]-1-1.html">• [field:subjectf unction="cn_substr( '@me' ,30) " /]</a><br/>{/dede:loop}

2. 我调用的是最新发布的帖子。调用代码如下

3. <UL>

{dede: loo p table='**********.pre_fo ru m_th read'so rt='tid' row='16'}

<LI><A h ref="/sheq u/fo ru m.p h p?mod=v iewth read&tid=[field:tid /]" target=_b lan k>[field:su bjectfu nction='cn_su bstr(@me,32)'/]</A></LI>

{/d ed e: lo o p}

</UL>

4. 说明 **********.pre_forum_thread其中的**********是你的数据库名称另外还要把代码中的shequ修改为你的discuz x的安装目录名称。你的DZX目录是什么就写什么这点很重要!如果你是调用的静态的那么就把代码中的链接改为的格式就可以了。根据你的网站需要你还可以修改其中的调用条数row='16'

5. 上面是动态内容的调用,如果你的论坛做了伪静态处理,那么调用的链接、修改下就可以了!调用演示如下:

6. <UL>

{dede: loo p table='**********.pre_fo ru m_th read'so rt='tid' row='16'}

<LI><A h ref="/sheq u/th read-[field:tid/]-1-1.htm l">[field:su bjectfu nction='cn_su bstr(@me,32)'/]</A></LI>

{/d ed e: lo o p}

</UL>

7. 如果调用的需要新窗口打开的话,可以在sheq u/th read-[field:tid/]-1-1.htm l后面加上targ et="_b lan k"例如:

8. <UL>

{dede: loo p table='**********.pre_fo ru m_th read'so rt='tid' row='16'}

<LI><A h ref="/sheq u/th read-[field:tid/]-1-1.htm l" target=_blan k>[field:su bjectfu nction='cn_su bstr(@me,32)'/]</A></LI>

{/d ed e: lo o p}

</UL>

9. 最后,下面发一个DEDE调用discuzx的家园home.php最新日志的代码调用代码如下(动态调用演示)

10. {dede: loop table='你的数据库名.pre_home_blog'sort='blog id' row='12'}

<LI>·<A href="/你的DZX安装子目录名

/ho m e.p h p?m od=space&u id=[field:u id/]&d o=b log&id=[field:b log i d/]"target=_blan k>[field:su bject fu nction='cn_su bstr(@me,28)'/]</A></LI>

{/d ed e: lo o p}

11. 同样你要修改你的数据库名或你安装DZX的目录名其实都很简单以前DEDE调用DZ的时候数据表名不一样论坛的cdb_threads数据表名变成了现在的pre_forum_thread UCHOM E的uchome_blog变成了现在的pre_h o m e_b log。

Boomer.host:$4.95/年-512MB/5GB/500GB/德克萨斯州(休斯顿)

部落曾经在去年分享过一次Boomer.host的信息,商家自述始于2018年,提供基于OpenVZ架构的VPS主机,配置不高价格较低。最近,主机商又在LET发了几款特价年付主机促销,最低每年仅4.95美元起,有独立IPv4+IPv6,开设在德克萨斯州休斯顿机房。下面列出几款VPS主机配置信息。CPU:1core内存:512MB硬盘:5G SSD流量:500GB/500Mbps架构:KVMIP/面板...

阿里云秋季促销活动 轻量云服务器2G5M配置新购年60元

已经有一段时间没有分享阿里云服务商的促销活动,主要原因在于他们以前的促销都仅限新用户,而且我们大部分人都已经有过账户基本上促销活动和我们无缘。即便老用户可选新产品购买,也是比较配置较高的,所以就懒得分享。这不看到有阿里云金秋活动,有不错的促销活动可以允许产品新购。即便我们是老用户,但是比如你没有购买过他们轻量服务器,也是可以享受优惠活动的。这次轻量服务器在金秋活动中力度折扣比较大,2G5M配置年付...

飞讯云E5-2678V3 64GB,湖北十堰100G高防物理机330元/月

飞讯云官网“飞讯云”是湖北飞讯网络有限公司旗下的云计算服务品牌,专注为个人开发者用户、中小型、大型企业用户提供一站式核心网络云端部署服务,促使用户云端部署化简为零,轻松快捷运用云计算。飞讯云是国内为数不多具有ISP/IDC双资质的专业云计算服务商,同时持有系统软件著作权证书、CNNIC地址分配联盟成员证书,通过了ISO27001信息安全管理体系国际认证、ISO9001质量保证体系国际认证。 《中华...

discuzx2为你推荐
现有新的ios更新可用请从ios14be苹果手机更新不了最新14系统是怎么回事?thinkphpthinkPHP怎么样呢destoondestoon有多少人用Destoon做站destoondestoon多少人是从PHP168过来的啊?Destoon的B2B很好,强烈支持你们destoondestoon这个变量是啥意思?2019支付宝五福支付宝5褔过了开奖时间怎么办iprouteip route-static 192.168.1.0 255.255.255.0 3.3.3.2什么意思支付宝调整还款日花呗调整还款日算延期吗?asp.net网页制作如何用ASP.NET做网站?大飞资讯新闻资讯包括什么内容?
息壤主机 香港服务器99idc 老左博客 双12活动 租空间 asp免费空间申请 腾讯实名认证中心 服务器是干什么的 美国堪萨斯 如何用qq邮箱发邮件 申请免费空间和域名 超级服务器 闪讯官网 云服务器比较 免费网络空间 中国联通宽带测试 nnt 标准机柜 遨游论坛 更多