Phpcms V9调用Discuz X2.5论坛最新帖、最热帖、热门版
4789
Phpcms V9后台可以轻松整合最新的DZX程序,或许有同学会问:怎么整合?而在这里,我们将分享Phpcms V9调用Discuz X2.5论坛最新帖、最热帖、热门版块排行的具体调用方法。
下面具体一一来列出PC V9引用DZX2.5的数据的代码:
一、Phpcms V9调用Discuz X2.5论坛指定版块帖子或回复:
{pc:get sql="SELECT * FROM discuzx.pre_forum_post where first=1 and fid=62 order by tid desc" num="1" cache="" return="data"} {loop $data $key $val} <dt><a href="http://论坛网址/thread-{$val[tid]}-1-1.html"><strong> {str_cut($val[subject],60,'')}</strong></a></dt> <dd> <p>{str_cut($val[message],168,'')}…</p> </dd> {/loop} {/pc}解释:first=1 就是帖子的1楼,如果=0 就是调用回复。message 截取168字符。fid=62 是论坛版块号。
二、Phpcms V9调用Discuz X2.5论坛最新帖子 并显示版块名称:
{pc:get sql="SELECT a.*,b.* FROM discuzx.pre_forum_thread as a left join discuzx.pre_forum_forum as b on a.fid=b.fid order by tid desc" num="4" cache="" return="data"} {loop $data $key $val} <li><a id="lanmu" href="http://论坛网址/forum-{$val[fid]}-1.html">[{$val[name]}]</a>& amp; lt;a href="http://论坛网址/thread-{$val[tid]}-1-1.html"> {str_cut($val[subject],60,'')}</a></li> {/loop} {/pc}解释:first=1 就是帖子的1楼,如果=0 就是调用回复。message 截取168字符。fid=62 是论坛版块号。
三、Phpcms V9调用Discuz X2.5论坛最新帖子 并显示版块名称:
{pc:get sql="SELECT a.*,b.* FROM discuzx.pre_forum_thread as a left join discuzx.pre_forum_forum as b on a.fid=b.fid order by tid desc" num="4" cache="" return="data"} {loop $data $key $val} <li><a id="lanmu" href="http://论坛网址/forum-{$val[fid]}-1.html">[{$val[name]}]</a>& amp; lt;a href="http://论坛网址/thread-{$val[tid]}-1-1.html"> {str_cut($val[subject],60,'')}</a></li> {/loop} {/pc}如果按积分排行调用论坛用户头像和名称,也可以将 credits改成regdate,就是最新注册加入的会员。具体代码为:
{pc:get sql="SELECT * FROM discuzx.pre_common_member order by credits desc" num="10" cache="" return="data"} {loop $data $key $val} <span> <a href="http://论坛网址/space-uid-{$val[uid]}.html"><img alt="{$val[username]}" src="http://论坛网址/uc_server/avatar.php?uid={$val[uid]}&size=small" /></a> <a href="http://论坛网址/space-uid-{$val[uid]}.html">{str_cut($val[username],9,'')}</a> </span> {/loop} {/pc}四、Phpcms V9调用Discuz X2.5论坛热门版块排行:
{pc:get sql="SELECT * FROM discuzx.pre_forum_forum order by threads desc" num="10" cache="" return="data"} {loop $data $key $val} <li><span><a href="http://论坛网址/forum-{$val[fid]}-1.html">{$val[name]}</a>& amp; lt;/span> <span><!--<span class="fatieshu">{$val[threads]}</span>主题 -->共<span class="fatieshu">{$val[posts]}</span>帖 今<span class="fatieshu">{$val[todayposts]}</span>帖</span>< /li> {/loop} {/pc}五、Phpcms V9调用Discuz X2.5论坛最热帖:
{pc:get sql="SELECT * FROM discuzx.pre_forum_thread order by views desc" num="6" cache="" return="data"} {loop $data $key $val} <li><a href="http://论坛网址/thread-{$val[tid]}-1-1.html">{str_cut($val[subject],54,'')}</a></li> {/loop} {/pc}六:Phpcms V9调用Discuz X2.5论坛最新帖:
{pc:get sql="SELECT * FROM discuzx.pre_forum_thread order by tid desc" num="6" cache="" return="data"} {loop $data $key $val} <li><a href="http://论坛网址/thread-{$val[tid]}-1-1.html">{str_cut($val[subject],54,'')}</a></li> {/loop} {/pc}上面的Phpcms V9调用Discuz X2.5论坛数据代码,你不妨试试!
本文网址:https://www.zztuku.com/index.php/detail-8060.html
站长图库 - Phpcms V9调用Discuz X2.5论坛最新帖、最热帖、热门版
申明:如有侵犯,请 联系我们 删除。
您还没有登录,请 登录 后发表评论!
提示:请勿发布广告垃圾评论,否则封号处理!!