本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}