本人自建了一个频道(为了调用分类名称),然后在里面调用某个论坛版块的主题列表(调用部分内容和主题分类名称)
SQL语句:
- SELECT t.tid,t.fid,t.subject,t.dateline,t.views,t.replies,f.typeid,f.name,g.message,g.tid FROM `cdb_threads`t,`cdb_threadtypes`f,`cdb_posts`g WHERE t.typeid=f.typeid and t.fid=35 and t.tid=g.tid ORDER BY t.`tid` DESC
复制代码
其中的35是版块ID号,放入新建的频道的代码是
- <!--{block name="bbsthread" parameter="sql/SELECT%20t.tid%2Ct.fid%2Ct.subject%2Ct.dateline%2Ct.views%2Ct.replies%2Cf.typeid%2Cf.name%2Cg.message%2Cg.tid%20FROM%20%60cdb_threads%60t%2C%60cdb_threadtypes%60f%2C%60cdb_posts%60g%20WHERE%20t.typeid%3Df.typeid%20and%20t.fid%3D35%20and%20t.tid%3Dg.tid/perpage/5/subjectlen/100/messagelen/300/order/dateline DESC/cachename/house/tpl/data"}--><!--房屋交易(高级)-->
- <!--{if $_SBLOCK['house']}-->
- <ul class="commentlist">
- <!--{loop $_SBLOCK['house'] $value}-->
- <h1><a href="$value[url]" target="_self" title="$value[subjectall]">$value[subjectall]</a></h1>
- <p>$value[message] <span>[<a href="$bbsurl/forumdisplay.php?fid=$value[fid]&filter=type&typeid=$value[typeid]">$value[name]</a>]</span> <span>#date("m-d/y", $value["dateline"])#</span></p>
- <!--{/loop}-->
- </ul>
- <div class="pages">
- <!--{if $_SBLOCK[house_multipage]}-->
- $_SBLOCK[house_multipage]
- <!--{else}-->
- <div class="xspace-page"><span>当前只有一页</span></div>
- <!--{/if}-->
- </div>
- <!--{/if}-->
复制代码
调出来的主题没办法分页,如果是用原列表页的代码放入该频道的模板页面,是可以实现分页的,即:
- <!--{block name="bbsthread" parameter="perpage/20/fid/$fid/showdetail/1/messagelen/320/subjectlen/100/order/dateline DESC/cachename/newlist/tpl/data"}-->
- <!--{if $_SBLOCK['newlist']}-->
- <ul class="commentlist">
- <!--{loop $_SBLOCK['newlist'] $value}-->
- <h1><a href="$value[url]" target="_self">$value[subject]</a></h1>
- <p>$value[message] <a href="$value[url]" target="_self" class="smalltxt">...全文</a><span class="smalltxt">发表于: #date("Y-m-d", $value["dateline"])# <!--{if $value[replies]}-->回复:$value[replies]<!--{/if}--> 作者: <a href="$uchome_url/space.php?uid=$value[authorid]" target="_blank">$value[author]</a></span></p>
- <!--{/loop}-->
- </ul>
- <div class="pages">
- <!--{if $_SBLOCK[newlist_multipage]}-->
- $_SBLOCK[newlist_multipage]
- <!--{else}-->
- <div class="xspace-page"><span>当前只有一页</span></div>
- <!--{/if}-->
- </div>
- <!--{/if}-->
复制代码
只需把上面这段中的
- <!--{block name="bbsthread" parameter="perpage/20/fid/$fid/showdetail/1/messagelen/320/subjectlen/100/order/dateline DESC/cachename/newlist/tpl/data"}-->
复制代码
改成
- <!--{block name="bbsthread" parameter="sql/SELECT%20t.tid%2Ct.fid%2Ct.subject%2Ct.dateline%2Ct.views%2Ct.replies%2Cf.typeid%2Cf.name%2Cg.message%2Cg.tid%20FROM%20%60cdb_threads%60t%2C%60cdb_threadtypes%60f%2C%60cdb_posts%60g%20WHERE%20t.typeid%3Df.typeid%20and%20t.fid%3D35%20and%20t.tid%3Dg.tid/perpage/5/subjectlen/100/messagelen/300/order/dateline DESC/cachename/newlist/tpl/data"}--><!--房屋交易(高级)-->
复制代码
便不能分页了...
===================================
本人搞不懂,为什么通过SQL调出来的就不能实现分页,错在哪里呢?
望官方工作人员指正,谢谢! |