本文整理匯總了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);
}