TP2.0分页发现个问题

浏览:189 发布日期:2010/05/29
- 普通 - 未处理
public function index(){

$news = D("News");
$count = $news->count('','news_id'); //用这个方法取不到总条数,改成下面的就好了
//$count=$news->count();//统计记录总数
$listRows = '5'; //每页显示的记录数
$fields ='news_id,news_title,news_author,news_date';
/*载入分页类*/
import("ORG.Util.Page");
$page = new Page($count,$listRows); //定义分页类对象
/*获得分页的记录*/
$list = $news->field($fields)->order('news_id desc')->limit($page->firstRow.",".$page->listRows)->findAll();
$p = $page->show(); //显示分页类
$this->assign('list',$list);
$this->assign('page',$p);
$this->display();
}
评论(
后面还有条评论,点击查看>>