分页代码,详细的注释:
public function index(){
$User = D('User'); //实例化User类
import("ORG.Util.Page"); //导入系统分页类,文件是在系统目录下面,不是在项目目录下面;
$count = $User->count(); //得到分页 记录的数量
$p = new Page($count,5); // 实例化分页类
$list=$User->limit($p->firstRow.','.$p->listRows)->order("id desc")->select(); //获得列表,$p->firstRow()表示获得开始位置;
//各种标记:
$p->setConfig('prev',"<");
$p->setConfig('header',"条记录");
$p->setConfig('first','<<');
$p->setConfig('last','>>');
$p->setConfig('next','>');
$this->assign('page',$p->show());
$this->assign('list',$list);
$this->assign('try','this is the try');
$this->display();
}
public function index(){
$User = D('User'); //实例化User类
import("ORG.Util.Page"); //导入系统分页类,文件是在系统目录下面,不是在项目目录下面;
$count = $User->count(); //得到分页 记录的数量
$p = new Page($count,5); // 实例化分页类
$list=$User->limit($p->firstRow.','.$p->listRows)->order("id desc")->select(); //获得列表,$p->firstRow()表示获得开始位置;
//各种标记:
$p->setConfig('prev',"<");
$p->setConfig('header',"条记录");
$p->setConfig('first','<<');
$p->setConfig('last','>>');
$p->setConfig('next','>');
$this->assign('page',$p->show());
$this->assign('list',$list);
$this->assign('try','this is the try');
$this->display();
}
导入css后实现的效果,