當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Page::setConfig方法代碼示例

本文整理匯總了PHP中think\Page::setConfig方法的典型用法代碼示例。如果您正苦於以下問題:PHP Page::setConfig方法的具體用法?PHP Page::setConfig怎麽用?PHP Page::setConfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在think\Page的用法示例。


在下文中一共展示了Page::setConfig方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: goods_list

 public function goods_list()
 {
     $perpage = 10;
     $page = intval(I("get." . (C('VAR_PAGE') ? C('VAR_PAGE') : 'p'))) ? intval(I('get.' . (C('VAR_PAGE') ? C('VAR_PAGE') : 'p'))) : 1;
     $limit = ($page - 1) * $perpage . "," . $perpage;
     $cate1 = D("GoodsCategory")->cate1_list();
     $this->assign('cate1', $cate1);
     if ($_GET) {
         $cate1_id = I('get.cate1_id', 0);
         $cate2_id = I('get.cate2_id', 0);
         $cate3_id = I('get.cate3_id', 0);
         $key_word = I('get.key_word', '');
         if ($cate1_id > 0) {
             $where['cate1_id'] = $cate1_id;
             // 分類信息
             $where2['cht_category2.cate1_id'] = $cate1_id;
             $cate2 = D("GoodsCategory")->cate2_list($where2);
         } else {
             $where2['cht_category2.cate1_id'] = $cate1[0]['id'];
             $cate2 = D("GoodsCategory")->cate2_list($where2);
         }
         if ($cate2_id > 0) {
             $where['cate2_id'] = $cate2_id;
             $where3['cht_category3.cate2_id'] = $cate2_id;
             $cate3 = D("GoodsCategory")->cate3_list($where3);
         } else {
             $where3['cht_category3.cate2_id'] = $cate2[0]['id'];
             $cate3 = D("GoodsCategory")->cate3_list($where3);
         }
         if ($cate3_id > 0) {
             $where['cate3_id'] = $cate3_id;
         }
         if ($key_word != '') {
             $where['goods_name'] = array('like', "%" . $key_word . "%");
         }
         $where['store_id'] = UID;
         $where['is_show'] = 1;
         $goods = $this->_Model->goods_lists($where, $limit);
         $total = $this->_Model->goods_count($where);
     } else {
         // 分類信息
         $where2['cht_category2.cate1_id'] = $cate1[0]['id'];
         $cate2 = D("GoodsCategory")->cate2_list($where2);
         $where3['cht_category3.cate2_id'] = $cate2[0]['id'];
         $cate3 = D("GoodsCategory")->cate3_list($where3);
         // 獲取全部商品
         $where = array('store_id' => UID, 'is_show' => 1);
         $goods = $this->_Model->goods_lists($where, $limit);
         $total = $this->_Model->goods_count($where);
     }
     $pageobj = new Page($total, $perpage);
     $pageobj->setConfig('prev', '上一頁');
     $pageobj->setConfig('next', '下一頁');
     $pageshow = $pageobj->show();
     $this->assign('cate2', $cate2);
     $this->assign('cate3', $cate3);
     $this->assign("pageshow", $pageshow);
     $this->assign("goods", $goods);
     $this->display();
 }
開發者ID:TTLOVE,項目名稱:MyBuild,代碼行數:60,代碼來源:GoodsController.class.php

示例2: index

 /**
  * 投稿管理
  */
 public function index()
 {
     $adminId = $_SESSION['AdminId'];
     if (empty($adminId) == true) {
         $this->error('請先登錄', '/index.php/Root/User/login', 3);
     }
     $category = D('Category');
     $video = D('Video');
     $page = $_GET['p'];
     if (empty($page)) {
         $page = 1;
     }
     $videoList = $video->getVideoList($page);
     $categoryList = $category->getVideoCategory();
     $videoCount = $video->getVideoCount();
     $Page = new Page($videoCount, 6);
     // 實例化分頁類 傳入總記錄數和每頁顯示的記錄數
     $Page->rollPage = 5;
     $Page->setConfig('header', $videoCount);
     $Page->setConfig('first', '1...');
     $Page->setConfig('prev', '<<');
     $Page->setConfig('next', '>>');
     $Page->setConfig('theme', "<ul class='pagination'></li><li>%FIRST%</li><li>%UP_PAGE%</li><li>%LINK_PAGE%</li><li>%DOWN_PAGE%</li><li>%END%</li><li><a>共%HEADER%條記錄</a></ul>");
     $show = $Page->show();
     // 分頁顯示輸出
     $this->assign('page', $show);
     // 賦值分頁輸出
     $this->assign('categoryList', $categoryList);
     $this->assign('videoList', $videoList);
     $this->display();
 }
開發者ID:CodingBingo,項目名稱:VideoSystem,代碼行數:34,代碼來源:ContributeController.class.php

示例3: index

 public function index()
 {
     $perpage = 8;
     $page = intval(I("get." . (C('VAR_PAGE') ? C('VAR_PAGE') : 'p'))) ? intval(I('get.' . (C('VAR_PAGE') ? C('VAR_PAGE') : 'p'))) : 1;
     $limit = ($page - 1) * $perpage . "," . $perpage;
     $where = array('user_id' => UID);
     if ($_GET) {
         $key_word = I('get.key_word', '');
         if ($key_word != '') {
             $where['title'] = array('like', "%" . $key_word . "%");
         }
         $requirements = $this->_Model->requirement_lists($where, $limit);
         $total = $this->_Model->requirement_count($where);
     } else {
         // 獲取當前買家需求
         $requirements = $this->_Model->requirement_lists($where, $limit);
         $total = $this->_Model->requirement_count($where);
     }
     $pageobj = new Page($total, $perpage);
     $pageobj->setConfig('prev', '上一頁');
     $pageobj->setConfig('next', '下一頁');
     $pageshow = $pageobj->show();
     $this->assign("pageshow", $pageshow);
     $this->assign("requirements", $requirements);
     $this->display();
 }
開發者ID:TTLOVE,項目名稱:MyBuild,代碼行數:26,代碼來源:RequirementController.class.php

示例4: getPage

 function getPage($map)
 {
     $count = $this->where($map)->count();
     $Page = new \Think\Page($count, 20);
     $Page->setConfig('prev', '上一頁');
     $Page->setConfig('next', '下一頁');
     $Page->setConfig('first', '第一頁');
     $Page->setConfig('last', '尾頁');
     $Page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
     $show = $Page->show();
     return $show;
 }
開發者ID:gitchenze,項目名稱:soloshop,代碼行數:12,代碼來源:CollectModel.class.php

示例5: getPageResult

 public function getPageResult($wheres = array())
 {
     //默認條件,在調用該方法時不需要傳入
     $wheres['status'] = array('gt', -1);
     //查詢條件
     $pageHtml = "";
     //準備分頁工具條
     $pageSize = 3;
     //每頁顯示條數
     $totalRows = $this->where($wheres)->count();
     //按條件查詢出總條數
     $page = new Page($totalRows, $pageSize);
     //實例化分頁類 傳入總記錄數和每頁顯示的記錄數
     $page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
     //%HEADER% 總共多少條記錄
     $pageHtml = $page->show();
     //分頁顯示輸出
     if ($page->firstRow !== 0 && $page->firstRow > $totalRows) {
         //如果起始條數大於總條數,顯示最後一頁數據  起始條數(頁碼-1)*每頁數
         $page->firstRow = $totalRows - $page->listRows;
         //起始條數 =總條數-每頁顯示條數  加入數據庫裏麵有12條 4 那麽8  下麵就會根據地九條查詢
     }
     $row = $this->where($wheres)->limit($page->firstRow . ',' . $page->listRows)->select();
     //準備分頁列表數據
     return array('rows' => $row, 'pageHtml' => $pageHtml);
 }
開發者ID:EasySilent,項目名稱:php1009,代碼行數:26,代碼來源:BaseModel.class.php

示例6: getPageResult

 /**
  * 得到分頁要準備的數據
  * @return array
  */
 public function getPageResult($wheres = array())
 {
     //排除偽刪除的數據
     $wheres['obj.status'] = array('gt', -1);
     //每頁顯示記錄數和
     $pageSize = 2;
     //偽刪除之外的總的記錄數
     $this->alias('obj');
     $totalRows = $this->where($wheres)->count();
     //分頁工具的實例化
     $page = new Page($totalRows, $pageSize);
     //分頁主題設置
     $page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
     //組裝分頁鏈接
     $pageHtml = $page->show();
     //當前頁也數超過總頁數的處理
     if ($totalRows == 0) {
         //當總頁數為0的情況
         $page->firstRow = 0;
     } elseif ($page->firstRow >= $page->totalRows) {
         //當前頁的起始行數大於等於總行數就顯示最後一頁的數據
         $page->firstRow = $totalRows - $page->listRows;
     }
     //每頁的要顯示的數據
     $this->alias('obj');
     $this->_setModel();
     $rows = $this->where($wheres)->limit($page->firstRow, $page->listRows)->select();
     $this->_handleRows($rows);
     return array('rows' => $rows, 'pageHtml' => $pageHtml);
 }
開發者ID:myservergit,項目名稱:linux_shop,代碼行數:34,代碼來源:BaseModel.class.php

示例7: getPageResult

 public function getPageResult($where = array())
 {
     //1.獲取分頁工具條數據
     $where['status'] = array('gt', -1);
     $pageSize = 2;
     //每頁顯示條數
     $totalRows = $this->where($where)->count();
     // 總條數
     $page = new Page($totalRows, $pageSize);
     //創建分頁對象
     if ($page->totalRows > $page->listRows) {
         $page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
     }
     $pageHtml = $page->show();
     //生成分頁的html
     //2.準備分頁列表顯示數據
     if ($page->firstRow > $totalRows) {
         //刪除時當每頁的起始條數大於等於總條數時,說明該頁沒數據了,該項前回退一頁顯示
         //          或  $page->firstRow==$totalRows&&$totalRows!==0&&$totalRows>$page->listRows
         $page->firstRow = $totalRows - $page->listRows;
         //起始條數=總條數-每頁顯示條數
     }
     $rows = $this->where($where)->limit($page->firstRow, $page->listRows)->select();
     return array('rows' => $rows, 'pageHtml' => $pageHtml);
 }
開發者ID:wecontinue,項目名稱:php1009,代碼行數:25,代碼來源:SupplierModel.class.php

示例8: index

 public function index()
 {
     $perpage = 4;
     $page = intval(I("get." . (C('VAR_PAGE') ? C('VAR_PAGE') : 'p'))) ? intval(I('get.' . (C('VAR_PAGE') ? C('VAR_PAGE') : 'p'))) : 1;
     $limit = ($page - 1) * $perpage . "," . $perpage;
     // 開始查詢對應的數據
     $categorys = $this->_Model->category_lists($limit);
     $total = $this->_Model->category_count();
     $pageobj = new Page($total, $perpage);
     $pageobj->setConfig('prev', '上一頁');
     $pageobj->setConfig('next', '下一頁');
     $pageshow = $pageobj->show();
     $this->assign("pageshow", $pageshow);
     $this->assign("categorys", $categorys);
     $this->display();
 }
開發者ID:TTLOVE,項目名稱:MyBuild,代碼行數:16,代碼來源:CategoryImportController.class.php

示例9: getListWithPage

 public function getListWithPage($wheres = array())
 {
     //定義pageRasult為數組,rows為每頁數據顯示,pageTool是分頁工具條
     //定義每頁顯示的數據的限製  status>-1
     $this->alias('obj');
     //設置表的別名,方便連表查詢
     $wheres['obj.status'] = array('gt', -1);
     //分頁工具條
     $totalRows = $this->where($wheres)->count();
     $listRows = 5;
     //生成page對象,並設置分頁工具條的顯示狀態
     $pageModel = new Page($totalRows, $listRows);
     //設置分頁工具條的外觀
     $pageModel->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
     $pageTool = $pageModel->show();
     //如果總行數小於或等於每頁起始行數,則將起始行數設置為總行數減去每頁顯示的行數
     if ($totalRows <= $pageModel->firstRow) {
         $pageModel->firstRow = $totalRows - $listRows;
         if ($pageModel->firstRow <= 0) {
             $pageModel->firstRow = 0;
         }
     }
     $this->alias('obj');
     //設置表的別名,方便連表查詢
     //設置連表查詢的鉤子方法
     $this->_setModel();
     //每頁顯示條數
     $rows = $this->where($wheres)->limit($pageModel->firstRow, $pageModel->listRows)->select();
     //設置鉤子方法來修改rows中的數據
     $this->_setRows($rows);
     //將結果返回
     return array('rows' => $rows, 'pageTool' => $pageTool);
 }
開發者ID:ahblin,項目名稱:michael0112,代碼行數:33,代碼來源:BaseModel.class.php

示例10: getList

 public function getList($wheres = array())
 {
     //查詢條件為數據狀態大於 -1  的數據
     if (!empty($wheres)) {
         $wheres['status'] = array('gt', -1);
     } else {
         $wheres['status'] = array('gt', -1);
     }
     //獲取分頁的工具條
     $totalRows = $this->where($wheres)->count();
     //準備數數據狀態大於-1的總條數
     $listRows = 2;
     //確定每一頁顯示的數據條數
     //實例化分頁工具條的對像
     $page = new Page($totalRows, $listRows);
     //>>判斷是否要修改主題
     if ($totalRows > $listRows) {
         $page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
     }
     //存儲分頁的條件
     $pageHtml = $page->show();
     //>>每一頁的數據刪除完之後顯示這頁數據的上一頁
     //查詢出每一頁需要顯示的數據
     $this->limit($page->firstRow, $page->listRows)->where($wheres);
     $rows = parent::select();
     return array('rows' => $rows, 'pageHtml' => $pageHtml);
 }
開發者ID:githublming,項目名稱:1009php,代碼行數:27,代碼來源:BaseModel.class.php

示例11: getPageResult

 public function getPageResult($wheres = array())
 {
     /*
      * 分頁
      * 1.分頁工具條
      *   >>分頁類Page(總條數count,每頁記錄數);
      *   >>總條數count  where(array('status',array('gt',-1)))->$model->count();
      *   >>每頁記錄數  自定義也可以配置文件設置
      * 2.分頁數據查詢 排序
      *   >>limit(firstRow,listRow)
      */
     //分頁工具條
     //$totalRows=where()->count();
     $wheres['status'] = array('gt', -1);
     $totalRows = $this->where($wheres)->count();
     $pageSize = 2;
     $page = new Page($totalRows, $pageSize);
     //更換主題
     if ($page->totalRows > $page->listRows) {
         $page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
     }
     //當起始行數大於總行數
     /**
      * $page->firstRow 起始行數
      * $page->totalRows 總行數
      * $page->listRows 每頁記錄數
      */
     if ($page->firstRow >= $totalRows && $page->firstRow > 0) {
         $page->firstRow = $totalRows - $pageSize;
     }
     $pageHtml = $page->show();
     //分頁數據查詢
     $row = $this->where($wheres)->order('sort desc')->limit($page->firstRow, $page->listRows)->select();
     return array('rows' => $row, 'pageHtml' => $pageHtml);
 }
開發者ID:yangzhiweiga,項目名稱:php0904,代碼行數:35,代碼來源:BaseModel.class.php

示例12: course

 public function course()
 {
     $this->seo_set('培訓課程');
     if (!empty($_GET['name'])) {
         $where['title'] = array('LIKE', '%' . str_rp(trim($_GET['name'])) . '%');
     }
     $where['status'] = 1;
     $totalRows = D('CourseView')->where($where)->count();
     $page = new Page($totalRows, 10);
     $page->setConfig('prev', '上一頁');
     $page->setConfig('next', '下一頁');
     $page->setConfig('first', '首頁');
     $page->setConfig('last', '尾頁');
     $this->list = D('CourseView')->limit($page->firstRow . ',' . $page->listRows)->where($where)->order('asort DESC,addtime DESC')->select();
     $this->assign('page_show', $page->show());
     $this->cget = $_GET;
     $this->display();
 }
開發者ID:noikiy,項目名稱:ypx,代碼行數:18,代碼來源:AllController.class.php

示例13: index

 /**
  * 首頁
  */
 public function index()
 {
     $category = D('Category');
     $slide = D('Slide');
     $video = D('Video');
     $Video = M('Video');
     $user = D('User');
     $userId = $_SESSION['userId'];
     $userInfo = null;
     if (empty($userId) == false) {
         $userInfo = $user->getUserInfo($userId);
     }
     $p = $_GET['p'];
     if (empty($p)) {
         $p = 1;
     }
     $categoryList = $category->getVideoCategory();
     $slideList = $slide->getSlide();
     $topVideo = $video->getPopVideo(2);
     $newVideo = $Video->where('videoStatus = 1')->order('createTime desc')->page($p . ',6')->select();
     $newCount = count($newVideo);
     for ($i = 0; $i < $newCount; $i++) {
         $newVideo[$i]['labels'] = explode(',', $newVideo[$i]['videoLabel']);
     }
     $count = count($Video->where('videoStatus = 1')->select());
     $Page = new Page($count, 6);
     $Page->rollPage = 5;
     $Page->setConfig('header', $count);
     $Page->setConfig('first', '1...');
     $Page->setConfig('prev', '<<');
     $Page->setConfig('next', '>>');
     $Page->setConfig('theme', "<ul class='pagination'></li><li>%FIRST%</li><li>%UP_PAGE%</li><li>%LINK_PAGE%</li><li>%DOWN_PAGE%</li><li>%END%</li><li><a>共%HEADER%條記錄</a></ul>");
     $show = $Page->show();
     $this->assign('categoryList', $categoryList);
     $this->assign('slideList', $slideList);
     $this->assign('topVideoList', $topVideo);
     $this->assign('newVideoList', $newVideo);
     $this->assign('page', $show);
     $this->assign('userInfo', $userInfo);
     $this->display();
 }
開發者ID:CodingBingo,項目名稱:VideoSystem,代碼行數:44,代碼來源:IndexController.class.php

示例14: showPage

 public function showPage()
 {
     //導航欄標題的平均分配
     $sql = M('news_main');
     $where['type_id'] = 0;
     $count = $sql->where($where)->count();
     $this->assign('count', $count);
     //導航欄的顯示
     $sql = M('news_main');
     $allResult = $sql->order("type_id,news_id asc")->select();
     $where['type_id'] = 0;
     $result = $sql->where($where)->order("news_id asc")->select();
     $this->assign('result', $result);
     $type = 0;
     $cas = 0;
     foreach ($allResult as $key => $val) {
         if ($allResult[$key]['type_id'] != $type) {
             $type = $allResult[$key]['type_id'];
             $cas = 0;
         }
         if ($allResult[$key]['count'] == 0) {
             $result1[$allResult[$key]['type_id']][$cas++] = $val;
         }
     }
     $this->assign('result1', $result1);
     //側欄顯示
     $sql = M('home_page');
     $whereP['type_id'] = 0;
     $whereP['news_id'] = array(neq, 3);
     $allPageResult = $sql->where($whereP)->order("news_id asc")->select();
     $this->assign('PageResult', $allPageResult);
     //分頁 list顯示
     import("ORG.Util.Page");
     //導入分頁助手類
     $id = intval($_GET['type_id']);
     $sql = M('home_page');
     $where_list['type_id'] = $id;
     $total = $sql->where($where_list)->count();
     $num_per_page = 10;
     $page = new Page($total, $num_per_page);
     $page->setConfig('header', '篇文章');
     $show = $page->show();
     $PageContent = $sql->where($where_list)->limit("{$page->firstRow},{$page->listRows}")->order("addtime desc")->select();
     $this->assign('Pagecontent', $PageContent);
     foreach ($allPageResult as $key => $val) {
         if ($val['news_id'] == $id) {
             $Type_Title = $val['title'];
         }
     }
     $this->assign('Type_Title', $Type_Title);
     $this->assign('show', $show);
     $this->display();
 }
開發者ID:kingho1d,項目名稱:new_sdibt_jsj,代碼行數:53,代碼來源:HomePageController.class.php

示例15: index

 /**
  * 查詢問題列表
  * @param int $p 頁碼
  */
 public function index($p = 1)
 {
     // 分頁信息
     if ($p == 1) {
         $total = M('question')->count();
         $_SESSION["question.total"] = $total;
     }
     $page = new \Think\Page($_SESSION["question.total"], C('PAGESIZE'));
     $page->setConfig('prev', 'prev');
     $page->setConfig('next', 'next');
     $page->setConfig('first', 'first');
     $show = $page->show();
     //dump($show);
     // 通過執行存儲過程高效查詢分頁數據
     // 將問題關聯的tag 采用GROUP_CONCAT 有效減少數據庫查詢次數
     $query = "call proc_question_orderby_votes_desc({$page->firstRow},{$page->listRows}) ";
     $questions = M('question')->query($query);
     //        dump($questions);
     $this->assign('page', $show);
     $this->assign('questions', $questions);
     $this->display();
 }
開發者ID:xiaobudian,項目名稱:php,代碼行數:26,代碼來源:QuestionController.class.php


注:本文中的think\Page::setConfig方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。