本文整理汇总了PHP中think\Page::show方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::show方法的具体用法?PHP Page::show怎么用?PHP Page::show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类think\Page
的用法示例。
在下文中一共展示了Page::show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadRecharges
/**
* 加载机构流水数据。
* @param string $agencyId 机构ID
* @param string $typeId 交易类型ID
* @param string $flowId 资金流向ID
* @param string $channelId 资金渠道ID
* @param string $statusId 状态ID
* @return void
*/
public function loadRecharges($agencyId, $typeId, $flowId, $channelId, $statusId)
{
if (APP_DEBUG) {
trace("加载机构流水数据[agency=>{$agencyId}][type=>{$typeId}][flow=>{$flowId}][channel=>{$channelId}][status=>{$statusId}]...");
}
$_where = array();
//机构ID
if (isset($agencyId) && !empty($agencyId)) {
$_where['agency_id'] = $agencyId;
}
//交易类型ID
if (isset($typeId) && !empty($typeId)) {
$_where['type_id'] = $typeId;
}
//资金流向ID
if (isset($flowId) && !empty($flowId)) {
$_where['flow_id'] = $flowId;
}
//资金渠道ID
if (isset($channelId) && !empty($channelId)) {
$_where['channel_id'] = $channelId;
}
//状态ID
if (isset($statusId) && !empty($statusId)) {
$_where['status_id'] = $statusId;
}
//查询统计
$_totalRows = $this->table('hk_agency_fund_water_view')->where($_where)->count();
//查询数据
$_page = new Page($_totalRows);
$_data = $this->table('hk_agency_fund_water_view')->where($_where)->limit($_page->firstRow . ',' . $_page->listRows)->order('last_time desc')->select();
//初始化数据模型
return array('data' => $_data, 'page' => $_page->show());
}
示例2: getPageResult
public function getPageResult($wheres = array())
{
//过滤掉不显示出来的数据
$wheres['obj.status'] = array('gt', -1);
//准备分页工具条数据
$pageHtml = '';
$pageSize = 3;
$this->alias('obj');
$totalRows = $this->where($wheres)->count();
//显示的总条数
$page = new Page($totalRows, $pageSize);
$pageHtml = $page->show();
//生成分页的html
//当输入的页码过大无数据时,停留在最后一页
if ($page->firstRow >= $totalRows) {
$page->firstRow = $totalRows - $page->listRows;
}
if ($totalRows < 3) {
$page->firstRow = 0;
}
//为当前模型对应的表指定一个别名
$this->alias('obj');
//使用表连接查询
$this->_setModel();
//准备分页列表数据
$rows = $this->where($wheres)->limit($page->firstRow, $page->listRows)->select();
//进一步处理数据
$this->_handleRows($rows);
//返回数据
return array('rows' => $rows, 'pageHtml' => $pageHtml);
}
示例3: 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);
}
示例4: search
public function search()
{
$keyword = I("post.keyword");
if ($keyword) {
$_SESSION['keyword'] = $keyword;
} else {
if ($_SESSION['keyword']) {
$keyword = $_SESSION['keyword'];
}
}
if ($keyword) {
$total = M('Ask')->where(array("sfz" => $keyword))->count();
$Page = new \Think\Page($total, 10);
$this->assign('page', $Page->show());
$result = M("Ask")->where(array("sfz" => $keyword))->limit($Page->firstRow . ',' . $Page->listRows)->order("id DESC")->select();
foreach ($result as $key => $value) {
$member = M("Member")->where(array("uid" => $value["uid"]))->find();
$result[$key]["nickname"] = $member["nickname"];
}
if (!empty($result)) {
$this->assign("ask", $result);
$this->display("my");
} else {
$this->error("无查询结果!", U('Index/respond_to_society'));
}
} else {
$this->error("请输入您的证件号码!", U('Index/respond_to_society'));
}
}
示例5: index
public function index()
{
$id = intval($_GET['id']);
$name = trim($_GET['n']);
$map['title'] = array('LIKE', '%' . str_rp($name) . '%');
$map['uid'] = $id;
$map['status'] = 1;
if (intval($_GET['cid'])) {
$map['cate_id'] = intval($_GET['cid']);
}
if (trim($_GET['type']) == 'new') {
$title['name'] = '最新开班';
$order = 'addtime DESC,sort DESC';
} else {
$title['name'] = '课程列表';
$order = 'sort DESC,read_count DESC';
}
$totalRows = $this->mod->where($map)->count();
$page = new Page($totalRows, 10);
$list = $this->mod->limit($page->firstRow . ',' . $page->listRows)->where($map)->order($order)->select();
$this->list = $list;
$this->assign('page_show', $page->show());
$this->member_seo_set($id, '课程列表');
$this->display();
}
示例6: 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();
}
示例7: index
public function index()
{
$ac_id = I('cate', 0, 'int');
$pid = M('ArticleClass')->where(array('ac_id' => $ac_id))->getField('ac_parent_id');
if ($pid) {
$this->ac_list = M('ArticleClass')->where(array('ac_parent_id' => $pid))->order('ac_sort desc')->select();
} else {
$this->ac_list = M('ArticleClass')->where(array('ac_parent_id' => $ac_id))->order('ac_sort desc')->select();
}
$ac_list = M('ArticleClass')->order('ac_sort desc')->select();
$ac_list = getChildsId($ac_list, $ac_id, 'ac_id', 'ac_parent_id');
if (is_array($ac_list)) {
$ac_list_str = $ac_id . ',';
foreach ($ac_list as $key => $val) {
$ac_list_str .= $val . ',';
}
$ac_list_str = substr($ac_list_str, 0, -1);
}
$where['ac_id'] = array('IN', $ac_list_str);
$where['article_show'] = 1;
$count = $this->model->where($where)->count();
$page = new Page($count, 10);
$list = $this->model->where($where)->limit($page->firstRow . ',' . $page->listRows)->order('article_sort desc,article_time desc')->select();
$this->list = $list;
$this->page = $page->show();
$this->display();
}
示例8: 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);
}
示例9: getPage
public function getPage($wheres = array())
{
//设置默认值则在调用时可以不用传入参数都可以
//查询条件, 分页的数据和总条数数据都是需要查询出状态大于1的记录
$wheres["obj.status"] = array("gt", -1);
//准备分页工具条
$pageHtml = "";
$pageSize = 5;
//每页多少条
$this->alias('obj');
$count = $this->where($wheres)->count();
//总条数
$page = new Page($count, $pageSize);
$pageHtml = $page->show();
//生成分页的html
//分页数据
//如果起始条数大于总的条数就直接显示最后一页的数据
if ($page->firstRow > $count) {
//起始条数= 总条数-每页多少条
$page->firstRow = $count - $page->listRows;
}
//为表取个别名
$this->alias('obj');
$this->_setModel();
//调用钩子方法
//得到分页后的每页的数据...
$row = $this->where($wheres)->limit($page->firstRow, $page->listRows)->select();
//返回分页数据
return array("rows" => $row, "pageHtml" => $pageHtml);
}
示例10: getHot
public function getHot($hour = 1, $num = 10, $page = 1)
{
$map['create_time'] = array('gt', time() - $hour * 60 * 60);
$map['status'] = 1;
$weiboModel = D('Weibo');
$all_topic = $this->where(array('status' => 1), array(array('read_count' => array('neq', 0))))->select();
foreach ($all_topic as $key => &$v) {
$map['content'] = array('like', "%#{$v['name']}#%");
$v['weibos'] = $weiboModel->where($map)->count();
if ($v['weibos'] == 0) {
unset($all_topic[$key]);
}
$v['user'] = query_user(array('space_link'), $v['uadmin']);
}
unset($v);
$all_topic = $this->arraySortByKey($all_topic, 'weibos', false);
$i = 0;
foreach ($all_topic as &$v) {
$v['top_num'] = ++$i;
}
unset($v);
$pager = new Page(count($all_topic), $num);
// dump($all_topic);exit;
$list['data'] = array_slice($all_topic, ($page - 1) * $num, $num);
$list['html'] = $pager->show();
return $list;
}
示例11: index
public function index()
{
if (IS_POST) {
if (!empty($_POST['del_id'])) {
$del_ids = '';
foreach ($_POST['del_id'] as $exam_id) {
$del_ids .= $exam_id . ',';
}
$del_ids = substr($del_ids, 0, -1);
$res = $this->model->where(array('exam_id' => array('IN', $del_ids)))->delete();
if ($res) {
$this->success('删除成功');
} else {
$this->error('删除失败');
}
}
} elseif (IS_GET) {
$where = array();
if (trim($_GET['exam_question'])) {
$where['exam_question'] = array('LIKE', '%' . str_rp(trim($_GET['exam_question'])) . '%');
}
$count = $this->model->where($where)->count();
$page = new Page($count, 10);
$list = $this->model->where($where)->limit($page->firstRow . ',' . $page->listRows)->limit('exam_sort desc')->select();
$this->list = $list;
$this->page = $page->show();
$this->search = $_GET;
$this->display();
}
}
示例12: 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();
}
示例13: index
public function index()
{
$where = "int_id = c.id";
$everypage = "10";
//$res = $out->field("id,outtime,outprice,outamount")->relation(true)->order("outtime desc")->select();
$tbName = D("RevenueView");
// 实例化Data数据对象
$count = $tbName->where($where)->count();
// 查询满足要求的总记录数
$Page = new Page($count, $everypage);
// 实例化分页类 传入总记录数和每页显示的记录数(25)
$show = $Page->show();
// 分页显示输出// 进行分页数据查询 注意limit方法的参数要使用Page类的属性
$list = $tbName->where($where)->order("outtime desc")->limit($Page->firstRow . ',' . $Page->listRows)->select();
//print_r($list);
//var_dump($list);
// echo "SQL:" . $tbName->getLastSql();
$this->assign('list', $list);
// 赋值数据集
$this->assign('page', $show);
// 赋值分页输出
$outsum = $tbName->where($where)->sum("outsum");
$this->assign("outsum", $outsum);
$insum = $tbName->sum("insum");
$this->assign("insum", $insum);
$total = $outsum - $insum;
$this->assign("total", $total);
$this->display();
}
示例14: getPageResult
/**
* 得到分页列表中的数据
* $pageResult = >array(
* 'rows'=>二维数组. 分页列表数据
* 'pageHtml'=>分页工具条的html.
* )
*/
public function getPageResult($wheres = array())
{
//有默认的条件, 在调用该方法是不需要传入.
//因为总条数和分页列表都需要查询出状态>-1的数据
$wheres['obj.status'] = array('gt', -1);
//>>1.准备分页工具条html
$pageHtml = '';
$pageSize = 5;
//每页多少条
$this->alias('obj');
$totalRows = $this->where($wheres)->count();
//总条数
$page = new Page($totalRows, $pageSize);
$pageHtml = $page->show();
//生成分页的html
//>>2.准备分页列表数据
//$page->firstRow 起始条数 (页码-1)*每页数
if ($page->firstRow > $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);
}
示例15: index
public function index()
{
if (IS_POST) {
//删除处理
if (is_array($_POST['del_id']) && !empty($_POST['del_id'])) {
foreach ($_POST['del_id'] as $article_id) {
//删除图片
$article_pic = $this->art->where('article_id=' . $article_id)->getField('article_pic');
if ($article_pic) {
@unlink(BasePath . '/Uploads/' . $article_pic);
}
$this->art->where('article_id=' . $article_id)->delete();
}
$this->success("操作成功", U('article'));
exit;
} else {
$this->error("请选择要操作的对象");
}
} elseif (IS_GET) {
$where = array();
$count = $this->model->where($where)->count();
$page = new Page($count, 10);
$list = $this->model->where($where)->limit($page->firstRow . ',' . $page->listRows)->order('store_sort desc')->select();
$this->assign('list', $list);
$this->assign('show_page', $page->show());
$this->display();
}
}