#1 phpfans
刚接触SpeedPHP框架,很多东西还在熟悉学习中,在做栏目分页列表时,遇到了问题,看了帮助教程和论坛相关帖子,但是问题还是没解决,向各位请教一下。在实际开发中,一般来说栏目分页列表是根据栏目ID读取相关内容,然后进行分页的,但是我用SpeedPHP框架,翻页时,栏目ID是空的,也就是模板中没有取到栏目ID,贴上代码请帮忙看看问题出在了哪里,谢谢。
main.php代码
public function newslist(){
if($classid = $this->spArgs("classid")){
$artPageList = spClass("lib_news");
$this->results = $artPageList->spPager($this->spArgs('page', 1), 2)->findAll(array('classid'=>$classid));
$this->pager = $artPageList->spPager()->getPager();
}else{
$this->error("栏目ID不能为空!", spUrl("main","index"));
}
}
main.newslist.html模板中的代码,classid是栏目的ID,我需要实现的就是根据栏目ID获取内容并分页
<{if $pager}>
共<{$pager.total_count}>条,分<{$pager.total_page}>页(每页<{$pager.page_size}>条):
<{if $pager.current_page != $pager.first_page}>
前页 |
上一页 |
<{/if}>
<{foreach from=$pager.all_pages item=thepage}>
<{if $thepage != $pager.current_page}>
<{$thepage}>
<{else}>
<{$thepage}>
<{/if}>
<{/foreach}>
<{if $pager.current_page != $pager.last_page}>
|
下一页 |
后页
<{/if}>
<{/if}>
2011-10-05 20:34:39