国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > CMS > 織夢DEDE > 正文

織夢CMS調用discuz X2(指定板塊)最新帖子的方法

2024-07-09 22:52:24
字體:
來源:轉載
供稿:網友

調用discuz X2(指定板塊)最新帖子的方法

第一種方法:

  1. {dede:sql sql="select * from ultrax.pre_forum_ thread where fid=37 limit 0,10"}
  2. <li><a href="/bbs/forum.php?mod=viewthread&tid=[field:tid /] ">
  3. [field:subject function="cn_substr('@me',60)" /] [field:lastpost function="date('m-d H:M','@me')" /] </a></li>
  4. {/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 靜態論壇最新主題 的方法:(偽靜態)

  1. {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)" /]</a><br/>{/dede:loop}

2、論壇指定版塊帖子調用方法: (偽靜態)

  1. { dede:loop table=“pre_forum_thread” if="fid=1 or fid=2 and displayorder!=-1" sort="tid" row="6" } 
  2. <a href=" [field:global.cfg_cmspath/]/bbs/thread-[field:tid /]-1-1.html" target="_blank">
  3. · [field:subject function="cn_substr(' @ me',50)" /] </a>
  4. <br/>
  5. { /dede:loop } 

其中的fid=1 or fid=2是論壇主題分類id,可以按照自己要求來修改,如 果是一個分類就直接寫fid=x

3、論壇調精華主題調用代碼如下 :(偽靜態)

  1. {dede:loop table=“pre_forum_thread” if="displayorder!=-1" sort="tid" row="10"}
  2. <a href=" [field:global.cfg_cmspath/]/bbs/thread-[field:tid /]-1- 1.html">
  3. · [field:subject function="cn_substr('@me',30)" /] ([field:lastpost function="date('m-d H:M','@me')" /]) </a>
  4. <br/>
  5. {/dede:loop} 

4. 如果想調用某個板塊的精華主題 代碼如下:(偽靜態)

  1. {dede:loop table=“pre_forum_thread” if="fid=5 and displayorder!= -1" sort="tid" row="10"}
  2. <a href=" [field:global.cfg_cmspath/]/bbs/thread-[field:tid /]-1- 1.html">
  3. [field:subject function="cn_substr('@me',30)" /]([field:lastpost function="date('m-d H:M','@me')" /]) </a>
  4. <br/>
  5. {/dede:loop} 

其中的fid=5是論壇主題分類id,可以按照自己要求來修改, 

如果想調用論壇所有 的板塊的最新精華主題只要去掉fid=5 and 就可以了。

4、調用的帖子列表這可以按查看 次數排序,(偽靜態)

  1. {dede:loop table=“pre_forum_thread” sort="views" row="10"}
  2. <a href=" [field:global.cfg_cmspath/]/bbs/viewthread.php?tid=[field:tid /] ">
  3. · [field:subject function="cn_substr('@me',30)" /] ([field:lastpost function="date('m-d H:M','@me')" /]) </a>
  4. <br/>
  5. {/dede:loop} 

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

5、論壇置頂版塊帖子調用方法舉 例:(偽靜態)

  1. { dede:loop table=“pre_forum_thread” sort="dateline" if="fid='3' and typeid='51'" row="10" }
  2. <a href=" [field:global.cfg_cmspath/]/bbs/thread-[field:tid /]-1-1.html" target="_blank">
  3. · [field:subject function="cn_substr(' @ me',30)" /]</a> <br>
  4. { /dede:loop }

論壇最新主題調用:

  1. {dede:loop table=" pre_forum_thread " sort="tid" row="10"}
  2. <a href="/dz/viewthread.php?tid=[field:tid /]">
  3. · [field:subject function="cn_substr('@me',30)" /] ([field:lastpost function="date('m-d H:M','@me')" /])
  4. </a>
  5. <br/>
  6. {/dede:loop}

調用特定板塊的主題

  1. {dede:loop table=" pre_forum_thread" if="fid=5 and displayorder!=-1" sort="tid" row="10"}
  2. <a href="/dz/viewthread.php?tid=[field:tid /] ">
  3. ·[field:subject function="cn_substr('@me',30)" /]([field:lastpost function="date('m-d H:M','@me')" /])
  4. </a>
  5. <br/>

調用論壇指定板塊精 華帖。

  1. {dede:loop table=" pre_forum_thread " if="fid=5 AND digest>0 and displayorder!=-1 " sort="tid" row="10"}
  2. <a href="/dz/viewthread.php?tid=[field:tid /]">
  3. · [field:subject function="cn_substr('@me',30)" /] ([field:lastpost function="date('m-d H:M','@me')" /])
  4. </a>
  5. <br/>

調用論壇指定板塊精 華帖(按查看次 數排序):

論壇最新主題: <br/>

  1. {dede:loop table=" pre_forum_thread " if="fid=5 and displayorder!=- 1" sort="views" row="10"}
  2. <a href="/dz/viewthread.php?tid=[field:tid /]">
  3. · [field:subject function="cn_substr('@me',30)" /] ([field:lastpost function="date('m-d H:M','@me')" /])
  4. </a>
  5. <br/>
  6. {/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 /]”

結合網上關于dede調用dz7.0以前的教程,得出dede調用 dx靜態論壇最新方法:

1. dede調用  Dx1.0之后,包括dx1.5,dx2.0 靜態論壇最新主題的方法 :(偽靜態)

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

2.      我調用的是最新發布的帖子。調用代碼如下:

  1. <UL>
  2.  {dede:loop table='**********.pre_forum_thread' sort='tid' row='16' }
  3.   <LI><A href="/shequ/forum.php? mod=viewthread&tid=[field:tid /]"  target=_blank> [field:subject function='cn_substr(@me,32)'/]</A> </LI>
  4.   {/dede:loop}
  5.   </UL>
  6. 說明:**********.pre_forum_thread 其中的**********是你的數據庫名稱 ,另外還要把代碼中的shequ修改為你的 discuz x的安裝目錄名稱。你的DZX目錄是什么就寫什么,這 點很重要!如果你是調用的靜態的,那么就把代碼中的鏈接改為的格式就可以了。 根據你的網站需要你還可以修改其中的調用條數row='16'
  7.  上面是動態內容的調用,如果你的論壇做了偽靜態處 理,那么調用的鏈接、修改下就可以了!調用演示如下:
  8. <UL>
  9.  {dede:loop table='**********.pre_forum_thread' sort='tid' row='16' }
  10.   <LI><A href="/shequ/thread-[field:tid /]-1- 1.html" >[field:subject function='cn_substr(@me,32)'/] </A> </LI>
  11.   {/dede:loop}
  12.  </UL>
  13.   如果調用的需要新窗口打開的話,可以在 shequ/thread-[field:tid /]-1- 1.html后面加上target="_blank" 例如:
  14.  <UL>
  15.  {dede:loop table='**********.pre_forum_thread' sort='tid' row='16' }
  16.   <LI><A href="/shequ/thread-[field:tid /]-1- 1.html"  target=_blank>[field:subject function='cn_substr (@me,32)'/]</A> </LI>
  17.   {/dede:loop}
  18.  </UL>
  19. 最后,下面發一個DEDE調用 discuz x的家園home.php最新日志的代碼調用代碼如下(動態調用演 示):
  20.  {dede:loop table='你的數據庫名.pre_home_blog' sort='blogid' row='12'}
  21.   <LI>·<A href="/你的DZ X安裝子目錄名/home.php?mod=space&uid=[field:uid/]&do=blog&id= [field:blogid/]"
  22.   target=_blank>[field:subject function='cn_substr(@me,28)'/] </A> </LI>
  23.   {/dede:loop}
  24. 同樣你要修改你的數據庫名,或你安裝DZX的目錄名,其實都很簡單 ,以前DEDE調用DZ的時候數據表名不一樣,論 壇的cdb_threads數據表名變成了現在的pre_forum_thread UCHOME的uchome_blog變成了現在的pre_home_blog。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 安庆市| 莒南县| 天等县| 民丰县| 舟山市| 清新县| 肥东县| 娱乐| 乐山市| 明光市| 家居| 芮城县| 增城市| 永德县| 牟定县| 同德县| 渭源县| 开远市| 繁昌县| 泸水县| 大同县| 兴宁市| 山西省| 襄樊市| 舞阳县| 长宁县| 方山县| 四子王旗| 万盛区| 察雅县| 萝北县| 奎屯市| 潞西市| 醴陵市| 五华县| 兰坪| 宁陵县| 茶陵县| 威宁| 海盐县| 汕尾市|