本文整理汇总了PHP中Pagination::fpage方法的典型用法代码示例。如果您正苦于以下问题:PHP Pagination::fpage方法的具体用法?PHP Pagination::fpage怎么用?PHP Pagination::fpage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pagination
的用法示例。
在下文中一共展示了Pagination::fpage方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionIndex()
{
//通过模型Model实现数据表信息查询
//产生模型对象
$article_model = Article::model();
//1.获得总的记录数目
$cnt = $article_model->count();
$per = 16;
//2. 实例化分页类对象
$page = new Pagination($cnt, $per);
//3. 重新按照分页的样式拼装sql语句进行查询,按时间排序order by 时间 desc
$sql = "select * from {{article}} order by create_time desc {$page->limit}";
$article_infos = $article_model->findAllBySql($sql);
//4. 获得分页页面列表(需要传递到视图模板里边显示)
//$page_list = $page->fpage(array(0,1,2,3,4,5,6,7,8));
$page_list = $page->fpage(array(2, 3, 4, 5, 6, 7, 8));
//部分显示
$numcon = $page->fpage(array(0));
//全部显示
//$page_list = $page->fpage();
//最新的感觉
//$xin = Article::model()->findAll(array('order'=>'create_time desc','limit'=>10));
//点击最多排序
$re = Article::model()->findAll(array('order' => 'click desc', 'limit' => 16));
//更多相关阅读
/*$xiangguan=Article::model()->findAll(array("condition" =>"cateId=".$article->cateId." and status = 1","limit"=>5,'order'=>'create_time desc'));
//seo设置
$this->pageKeyword=array(
'title'=>$article->title.'-'.$article->CateOne->name.'-'.Helper::siteConfig()->site_name,
'keywords'=>$article->keywords,
'description'=>Helper::truncate_utf8_string($article->des,100),
);*/
//统计感觉的总数
$cmodel = Article::model()->findAll();
$count = count($cmodel);
$data = array('numcon' => $numcon, 're' => $re, 'article_infos' => $article_infos, 'page_list' => $page_list, 'count' => $count);
//调用视图模板,给模板传递数据
$this->render('index', $data);
}
示例2: actionIndex
public function actionIndex()
{
//1.获得总的记录数目
$cnt = count(User::model()->findAll());
$per = 10;
//2. 实例化分页类对象
$page = new Pagination($cnt, $per);
//3. 重新按照分页的样式拼装sql语句进行查询
$sql = "select * from {{user}} order by regtime desc {$page->limit}";
$users = User::model()->findAllBySql($sql);
//全部显示
$page_list = $page->fpage();
$data = array('users' => $users, 'page_list' => $page_list, 'cnt' => $cnt);
$this->render('index', $data);
}
示例3: actionCategory
function actionCategory()
{
//渲染视图
//render() 带布局渲染
//renderPartial() 部分渲染
error_reporting(E_ALL || ~E_NOTICE);
$goods_model = Goods::model();
$total = $goods_model->count();
$per = 8;
$page = new Pagination($total, $per);
$sql = "select * from {{goods}} {$page->limit}";
$goods_infos = $goods_model->findAllBySql($sql);
$page_list = $page->fpage();
$this->render('category', array('goods_infos' => $goods_infos, 'page_list' => $page_list));
}
示例4: actionIndex
public function actionIndex()
{
$where = '1';
$limit = 10;
$criteria = new CDbCriteria();
$criteria->select = '*';
$count = $this->userModel->count($where);
$page = new Pagination($count, $limit);
$criteria->limit = $limit;
$criteria->offset = $page->limit;
$criteria->order = 'userid DESC';
$list = $this->userModel->findAll($criteria);
$page_list = $page->fpage();
$this->render('index', array('userList' => $list, 'page_list' => $page_list));
}
示例5: displayList
protected function displayList($model, $where)
{
// 用户列表
$list = CModel::factory($model)->getList($where);
$this->assign('list', $list);
// 分页
$count = CModel::factory($model)->getCount($where);
if (!empty($list)) {
$pageObject = new Pagination($count, CModel::factory($model)->pageRows);
$pagestr = $pageObject->fpage(array(3, 4, 5, 6, 7));
$this->assign('page', $pagestr);
}
$this->assign('count', $count);
$this->assign('where', $where);
$this->display();
}
示例6: Pagination
function actionShow1()
{
//获得数据模型
$goods_model = Goods::model();
//1.获得商品总的记录数目
$cnt = $goods_model->count();
$per = 6;
//2. 实例化分页类对象
$page = new Pagination($cnt, $per);
//3. 重新按照分页的样式拼装sql语句进行查询
$sql = "select * from {{goods}} {$page->limit}";
$goods_infos = $goods_model->findAllBySql($sql);
//4. 获得分页页面列表(需要传递到视图模板里边显示)
$page_list = $page->fpage(array(3, 4, 5, 6, 7));
//调用视图模板,给模板传递数据
$this->renderPartial('show', array('goods_infos' => $goods_infos, 'page_list' => $page_list));
}
示例7: actionIndex
public function actionIndex()
{
$model = Msg::model();
//1.获得总的记录数目
$cnt = $model->count();
$per = 10;
//2. 实例化分页类对象
$page = new Pagination($cnt, $per);
//3. 重新按照分页的样式拼装sql语句进行查询
$sql = "select * from {{msg}} order by time desc {$page->limit}";
$msgshow = $model->findAllBySql($sql);
//4. 获得分页页面列表(需要传递到视图模板里边显示)
//$page_list = $page->fpage(array(3,4,5,6,7));//部分显示
//全部显示
$page_list = $page->fpage();
$data = array('msg' => $msgshow, 'page_list' => $page_list);
$this->render('index', $data);
}
示例8: actionIndex
public function actionIndex()
{
$article_model = Article::model();
//1.获得总的记录数目
$cnt = $article_model->count();
$per = 10;
//2. 实例化分页类对象
$page = new Pagination($cnt, $per);
//3. 重新按照分页的样式拼装sql语句进行查询
$sql = "select * from {{article}} order by create_time desc {$page->limit}";
$article_infos = $article_model->findAllBySql($sql);
//4. 获得分页页面列表(需要传递到视图模板里边显示)
//$page_list = $page->fpage(array(3,4,5,6,7));//部分显示
//全部显示
$page_list = $page->fpage();
$data = array('article_infos' => $article_infos, 'page_list' => $page_list);
//调用视图模板,给模板传递数据
$this->render('index', $data);
}