PHPCMS V9调用Discuz X2.5指定版块帖子

  • 时间:
  • 浏览:21
  • 来源:5分6合_5分6合网投平台_5分6合投注平台_5分6合娱乐平台
作者:匿名 hihi 来源:李应青的博客 浏览: 2012-8-16 16:58:01 字号:大 中 小

[摘要]PHPCMS V9调用DiscuzX 2.5指定版块帖子,PHPCMS V9调用DiscuzX 2.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],300,'')}</strong></a></dt>

<dd>

<p>{str_cut($val[message],168,'')}…</p>

</dd>

{/loop}

{/pc}

  解释:first=1 否则帖子的1楼,机会=0 否则调用回复。message 截取168字符。fid=62 是论坛版块号

  效果如下:

调用论坛最新帖子 并显示版块名称:

{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],300,'')}</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}

热门版块排行

{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}

最热帖

{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}

最新帖

{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}

  原文地址:http://www.liyingqing.com/archives/1238

sssss
Tags: PHPCMS   DiscuzX2.5   调用帖子  
责任编辑:mozi