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


PHP Page::SetPager方法代碼示例

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


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

示例1: sp_sql_posts_paged

/**
 * 4
 * @ 處理標簽函數
 * @ $tag以字符串方式傳入,通過sp_param_lable函數解析為以下變量。例:"cid:1,2;order:post_date desc,listorder desc;"
 * ids:調用指定id的一個或多個數據,如 1,2,3
 * cid:數據所在分類,可調出一個或多個分類數據,如 1,2,3 默認值為全部,在當前分類為:'.$cid.'
 * field:調用post指定字段,如(id,post_title...) 默認全部
 * limit:數據條數,默認值為10,可以指定從第幾條開始,如3,8(表示共調用8條,從第3條開始)
 * order:推薦方式(post_date) (desc/asc/rand())
 */
function sp_sql_posts_paged($tag, $pagesize = 20, $pagetpl = '{first}{prev}{liststart}{list}{listend}{next}{last}')
{
    $where = array();
    $tag = sp_param_lable($tag);
    $field = !empty($tag['field']) ? $tag['field'] : '*';
    $limit = !empty($tag['limit']) ? $tag['limit'] : '';
    $order = !empty($tag['order']) ? $tag['order'] : 'post_date';
    //根據參數生成查詢條件
    $where['status'] = array('eq', 1);
    $where['post_status'] = array('eq', 1);
    if (isset($tag['cid'])) {
        $where['term_id'] = array('in', $tag['cid']);
    }
    if (isset($tag['ids'])) {
        $where['object_id'] = array('in', $tag['ids']);
    }
    $join = "" . C('DB_PREFIX') . 'posts as b on a.object_id =b.id';
    $join2 = "" . C('DB_PREFIX') . 'users as c on b.post_author = c.id';
    $rs = M("PtermRelationships");
    $totalsize = $rs->alias("a")->join($join)->join($join2)->field($field)->where($where)->count();
    import('Page');
    if ($pagesize == 0) {
        $pagesize = 20;
    }
    $PageParam = C("VAR_PAGE");
    $page = new \Page($totalsize, $pagesize);
    $page->setLinkWraper("li");
    $page->SetPager('default', $pagetpl, array("listlong" => "6", "first" => "首頁", "last" => "尾頁", "prev" => "上一頁", "next" => "下一頁", "list" => "*", "disabledclass" => ""));
    $posts = $rs->alias("a")->join($join)->join($join2)->field($field)->where($where)->order($order)->limit($page->firstRow . ',' . $page->listRows)->select();
    $content['posts'] = $posts;
    $content['page'] = $page->show('default');
    return $content;
}
開發者ID:2flying2,項目名稱:IDF-CTF-PLAT,代碼行數:43,代碼來源:function.php

示例2: sp_sql_qiushis_paged

function sp_sql_qiushis_paged($tag = "", $pagesize = 20, $pagetpl = '{first}{prev}{liststart}{list}{listend}{next}{last}')
{
    $tag = sp_param_lable($tag);
    $field = !empty($tag['field']) ? $tag['field'] : 'b.*';
    $limit = !empty($tag['limit']) ? $tag['limit'] : '';
    $order = !empty($tag['order']) ? $tag['order'] : 'createtime desc';
    $field = "a.cat_name,c.user_login,c.user_nicename," . $field;
    $qiushi_cat_model = M("QiushiCat");
    $join = C('DB_PREFIX') . 'qiushi as b on a.id =b.cid';
    $join2 = C('DB_PREFIX') . 'users as c on c.id =b.uid';
    $where = array("b.status" => 1, "a.status" => 1);
    if (isset($tag['cid'])) {
        $where['cid'] = array('in', $tag['cid']);
    }
    $totalsize = $qiushi_cat_model->alias("a")->join($join)->where($where)->count();
    import('Page');
    $PageParam = C("VAR_PAGE");
    $page = new \Page($totalsize, $pagesize);
    $page->setLinkWraper("li");
    $page->__set("PageParam", $PageParam);
    $pagetpl = '{first}{prev}{liststart}{list}{listend}{next}{last}';
    $page->SetPager('default', $pagetpl, array("listlong" => "6", "first" => "首頁", "last" => "尾頁", "prev" => "上一頁", "next" => "下一頁", "list" => "*", "disabledclass" => ""));
    $qiushis = $qiushi_cat_model->field($field)->alias("a")->join($join)->join($join2)->where($where)->order($order)->limit($page->firstRow . ',' . $page->listRows)->select();
    $return['count'] = $totalsize;
    $return['items'] = $qiushis;
    $return['page'] = $page->show('default');
    return $return;
}
開發者ID:lvxiaolin,項目名稱:thinkcfm,代碼行數:28,代碼來源:function.php

示例3: index

 public function index()
 {
     $this->common();
     $cid = I("get.cid", '0', 'intval');
     $whereArr = empty($cid) ? array("status=1") : array("status=1", "cid={$cid}");
     $sort = I('get.sort', '', 'intval');
     if (!empty($sort)) {
         if ($sort == 1) {
             $order = "post_score ASC";
         } else {
             $order = "post_like DESC,remain ASC";
         }
     } else {
         $order = "listorder ASC,post_date DESC";
     }
     $where = join(" and ", $whereArr);
     import('Page');
     //總數
     $total = $this->model_shop->where($where)->count();
     $Page = new \Page($total, 12);
     $Page->SetPager('Home', '{first}{prev}&nbsp;{liststart}{list}{listend}&nbsp;{next}{last}', array("listlong" => "6", "first" => "首頁", "last" => "尾頁", "prev" => " < ", "next" => " > ", "list" => "*", "disabledclass" => ""));
     $list = $this->model_shop->where($where)->order($order)->limit($Page->firstRow . ',' . $Page->listRows)->select();
     $this->assign('list', $list);
     $this->assign('page', $Page->show("Home"));
     $this->assign("cid", $cid);
     $this->display();
 }
開發者ID:noikiy,項目名稱:luokeke2,代碼行數:27,代碼來源:ShopController.class.php

示例4: page

 protected function page($Total_Size = 1, $Page_Size = 0, $Current_Page = 1, $listRows = 6, $PageParam = '', $PageLink = '', $Static = FALSE)
 {
     import('Page');
     if ($Page_Size == 0) {
         $Page_Size = C("PAGE_LISTROWS");
     }
     if (empty($PageParam)) {
         $PageParam = C("VAR_PAGE");
     }
     $Page = new \Page($Total_Size, $Page_Size, $Current_Page, $listRows, $PageParam, $PageLink, $Static);
     $Page->SetPager('default', '{first}{prev}{liststart}{list}{listend}{next}{last}', array("listlong" => "9", "first" => "首頁", "last" => "尾頁", "prev" => "上一頁", "next" => "下一頁", "list" => "*", "disabledclass" => ""));
     return $Page;
 }
開發者ID:lvxiaolin,項目名稱:thinkcfm,代碼行數:13,代碼來源:AppframeController.class.php

示例5: lists

 public function lists()
 {
     $this->Article_common();
     $cid = I("get.cid", 0, 'intval');
     if (empty($cid)) {
         $cid = $this->model_cat->getField("id");
     }
     $fieldArr = array("id", "post_pic", "cid", "post_author", "post_title", "post_like", "post_share", "post_excerpt", "post_date");
     $whereArr = array("cid={$cid}", "status=1");
     $where = join(" and ", $whereArr);
     $field = join(",", $fieldArr);
     $order = "listorder ASC,post_date DESC";
     // 導入分頁類
     import('Page');
     //總數
     $total = $this->model_article->where($where)->count();
     $Page = new \Page($total, 5);
     $Page->SetPager('Home', '{first}{prev}&nbsp;{liststart}{list}{listend}&nbsp;{next}{last}', array("listlong" => "6", "first" => "首頁", "last" => "尾頁", "prev" => " < ", "next" => " > ", "list" => "*", "disabledclass" => ""));
     $list = $this->model_article->relation(true)->field($field)->where($where)->order($order)->limit($Page->firstRow . ',' . $Page->listRows)->select();
     $Page->SetPager('Phone', '{list}', array("listlong" => "5", 'list' => '*', 'disabledclass' => ''));
     //獲取每篇文章的二維碼
     for ($i = 0; $i < 5; $i++) {
         if (empty($list[$i])) {
             break;
         }
         $url = 'http://' . $_SERVER['HTTP_HOST'] . U("Portal/Article/info") . "/id/" . $list[$i]['id'];
         $list[$i]['qrpath'] = $this->qrcode($url);
     }
     $this->assign("list", $list);
     $this->assign('page', $Page->show("Home"));
     //手機分頁樣式
     $this->assign('phonepage', $Page->show('Phone'));
     $this->assign('totalpage', $Page->Total_Pages);
     $this->assign("cid", $cid);
     $this->assign("model_table", "Article");
     $this->display('list');
 }
開發者ID:noikiy,項目名稱:luokeke2,代碼行數:37,代碼來源:ArticleController.class.php

示例6: index

 public function index()
 {
     $qiushi_cat_model = M("QiushiCat");
     $join = C('DB_PREFIX') . 'qiushi as b on a.id =b.cid';
     $join2 = C('DB_PREFIX') . 'users as c on c.id =b.uid';
     $where = array("b.status" => 1, "a.status" => 1);
     $catid = I("get.cat", 0, "intval");
     if (!empty($catid)) {
         $where['a.id'] = $catid;
     }
     $order = array("b.istop" => "desc");
     $sort = I("get.sort", 0, "intval");
     if (empty($sort)) {
         $order['b.createtime'] = "desc";
     } else {
         $sort == 1 ? $order['b.last_comment'] = "desc" : "";
         //按最新回複
         if ($sort == 2) {
             //精華
             $where['b.star'] = array("gt", 0);
             $order['b.createtime'] = "desc";
         }
     }
     $totalsize = $qiushi_cat_model->alias("a")->join($join)->where($where)->count();
     import('Page');
     $PageParam = C("VAR_PAGE");
     $page = new \Page($totalsize, 15);
     $page->setLinkWraper("li");
     $page->__set("PageParam", $PageParam);
     $pagetpl = '{first}{prev}{liststart}{list}{listend}{next}{last}';
     $page->SetPager('default', $pagetpl, array("listlong" => "6", "first" => "首頁", "last" => "尾頁", "prev" => "上一頁", "next" => "下一頁", "list" => "*", "disabledclass" => ""));
     $qiushis = $qiushi_cat_model->field("a.cat_name,b.*,c.user_login,c.user_nicename")->alias("a")->join($join)->join($join2)->where($where)->order($order)->limit($page->firstRow . ',' . $page->listRows)->select();
     $this->assign("pager", $page->show('default'));
     $qiushi_cats = $qiushi_cat_model->where(array("status" => 1))->order("listorder asc")->select();
     $this->assign("qiushi_cats", $qiushi_cats);
     $catid = I("get.cat", 0, "intval");
     if (!empty($catid)) {
         $qiushi_cat = $qiushi_cat_model->where(array("id" => $catid))->find();
         $this->assign("qiushi_cat", $qiushi_cat);
     }
     $this->assign("qiushis", $qiushis);
     $this->display(":index");
 }
開發者ID:noikiy,項目名稱:cmfx,代碼行數:43,代碼來源:IndexController.class.php

示例7: index

 public function index()
 {
     $qiushi_cat_model = M("QiushiCat");
     $join = C('DB_PREFIX') . 'qiushi as b on a.id =b.cid';
     $join2 = C('DB_PREFIX') . 'users as c on c.id =b.uid';
     $where = array("b.uid" => get_current_userid());
     $totalsize = $qiushi_cat_model->alias("a")->join($join)->where($where)->count();
     import('Page');
     $PageParam = C("VAR_PAGE");
     $page = new \Page($totalsize, 10);
     $page->setLinkWraper("li");
     $page->__set("PageParam", $PageParam);
     $pagetpl = '{first}{prev}{liststart}{list}{listend}{next}{last}';
     $page->SetPager('default', $pagetpl, array("listlong" => "6", "first" => "首頁", "last" => "尾頁", "prev" => "上一頁", "next" => "下一頁", "list" => "*", "disabledclass" => ""));
     $qiushi_cats = $qiushi_cat_model->where(array("status" => 1))->select();
     $this->assign("qiushi_cats", $qiushi_cats);
     $join = C('DB_PREFIX') . 'qiushi as b on a.id =b.cid';
     $join2 = C('DB_PREFIX') . 'users as c on c.id =b.uid';
     $qiushis = $qiushi_cat_model->field("a.cat_name,b.*,c.user_login,c.user_nicename")->alias("a")->join($join)->join($join2)->where($where)->order("b.createtime desc")->limit($page->firstRow . ',' . $page->listRows)->select();
     $this->assign("pager", $page->show('default'));
     $this->assign("qiushis", $qiushis);
     $this->display();
 }
開發者ID:lvxiaolin,項目名稱:thinkcfm,代碼行數:23,代碼來源:UserController.class.php

示例8: sp_content_page

function sp_content_page($content, $pagetpl = '{first}{prev}{liststart}{list}{listend}{next}{last}')
{
    $contents = explode('_ueditor_page_break_tag_', $content);
    $totalsize = count($contents);
    import('Page');
    $pagesize = 1;
    $PageParam = C("VAR_PAGE");
    $page = new \Page($totalsize, $pagesize);
    $page->setLinkWraper("li");
    $page->SetPager('default', $pagetpl, array("listlong" => "6", "first" => "首頁", "last" => "尾頁", "prev" => "上一頁", "next" => "下一頁", "list" => "*", "disabledclass" => ""));
    $content = $contents[$page->firstRow];
    $data['content'] = $content;
    $data['page'] = $page->show('default');
    return $data;
}
開發者ID:noikiy,項目名稱:luokeke2,代碼行數:15,代碼來源:function.php

示例9: page

 /**
  * 分頁
  * @param type $Total_Size
  * @param type $Page_Size
  * @param type $Current_Page
  * @param type $listRows
  * @param type $PageParam
  * @param type $PageLink
  * @param type $Static
  * @return \Page 
  */
 protected function page($Total_Size = 1, $Page_Size = 0, $Current_Page = 1, $listRows = 6, $PageParam = '', $PageLink = '', $Static = FALSE)
 {
     import('Page');
     if ($Page_Size == 0) {
         $Page_Size = C("PAGE_LISTROWS");
     }
     if (empty($PageParam)) {
         $PageParam = C("VAR_PAGE");
     }
     $Page = new Page($Total_Size, $Page_Size, $Current_Page, $listRows, $PageParam, $PageLink, $Static);
     $Page->SetPager('Admin', '共有{recordcount}條信息&nbsp;{pageindex}/{pagecount}&nbsp;{first}{prev}&nbsp;{liststart}{list}{listend}&nbsp;{next}{last}&nbsp;轉到{jump}頁', array("listlong" => "6", "first" => "首頁", "last" => "尾頁", "prev" => "上一頁", "next" => "下一頁", "list" => "*", "disabledclass" => ""));
     return $Page;
 }
開發者ID:BGCX262,項目名稱:ztoa-svn-to-git,代碼行數:24,代碼來源:BaseAction.class.php

示例10: page

function page($total, $size = 0, $number = 0, $config = array())
{
    static $_pageCache = array();
    $cacheIterateId = to_guid_string(func_get_args());
    if (isset($_pageCache[$cacheIterateId])) {
        return $_pageCache[$cacheIterateId];
    }
    $defaultConfig = array('number' => $number, 'param' => C("VAR_PAGE"), 'rule' => '', 'isrule' => false, 'tpl' => '', 'tplconfig' => array('listlong' => 6, 'listsidelong' => 2, "first" => "首頁", "last" => "尾頁", "prev" => "上一頁", "next" => "下一頁", "list" => "*", "disabledclass" => ""));
    $cfg = array('listlong' => 6, 'listsidelong' => 2, 'list' => '*', 'currentclass' => 'current', 'first' => '&laquo;', 'prev' => '&#8249;', 'next' => '&#8250;', 'last' => '&raquo;', 'more' => '...', 'disabledclass' => 'disabled', 'jump' => '', 'jumpplus' => '', 'jumpaction' => '', 'jumplong' => 50);
    if (!empty($config) && is_array($config)) {
        $defaultConfig = array_merge($defaultConfig, $config);
    }
    $defaultConfig['size'] = $size ? $size : C("PAGE_LISTROWS");
    foreach ($cfg as $key => $value) {
        if (isset($defaultConfig[$key])) {
            $defaultConfig['tplconfig'][$key] = isset($defaultConfig[$key]) ? $defaultConfig[$key] : $value;
        }
    }
    import('Page');
    if ($defaultConfig['isrule'] && empty($defaultConfig['rule'])) {
        $URLRULE = $GLOBALS['URLRULE'] ? $GLOBALS['URLRULE'] : URLRULE;
        $PageLink = array();
        if (!is_array($URLRULE)) {
            $URLRULE = explode("~", $URLRULE);
        }
        $PageLink['index'] = $URLRULE['index'] ? $URLRULE['index'] : $URLRULE[0];
        $PageLink['list'] = $URLRULE['list'] ? $URLRULE['list'] : $URLRULE[1];
        $defaultConfig['rule'] = $PageLink;
    } else {
        if ($defaultConfig['isrule'] && !is_array($defaultConfig['rule'])) {
            $URLRULE = explode('|', $defaultConfig['rule']);
            $PageLink = array();
            $PageLink['index'] = $URLRULE[0];
            $PageLink['list'] = $URLRULE[1];
            $defaultConfig['rule'] = $PageLink;
        }
    }
    $Page = new Page($total, $defaultConfig['size'], $defaultConfig['number'], $defaultConfig['list'], $defaultConfig['param'], $defaultConfig['rule'], $defaultConfig['isrule']);
    $Page->SetPager('default', $defaultConfig['tpl'], $defaultConfig['tplconfig']);
    $_pageCache[$cacheIterateId] = $Page;
    return $_pageCache[$cacheIterateId];
}
開發者ID:NeilFee,項目名稱:vipxinbaigo,代碼行數:42,代碼來源:~runtime.php

示例11: pointlist

 public function pointlist()
 {
     $order = 'post_date DESC';
     $whereAnds = array("uid={$this->userid}");
     if (IS_POST) {
         if (!empty($_POST['control_date'])) {
             $get = strtotime($_POST['control_date']);
             array_push($whereAnds, "post_date >= {$get}");
         }
         if (!empty($_POST['control_date2'])) {
             $get = strtotime($_POST['control_date2']);
             array_push($whereAnds, "post_date <= {$get}");
         }
         if (!empty($_POST['TypeID'])) {
             if ($_POST['TypeID'] == 1) {
                 array_push($whereAnds, "gid = 0");
             } elseif ($_POST['TypeID'] == 2) {
                 array_push($whereAnds, "gid > 0");
             } else {
                 array_push($whereAnds, "gid >= 0");
             }
         }
     }
     $where = join(" and ", $whereAnds);
     $count = $this->exchange->where($where)->count();
     import('Page');
     $Page = new \Page($count, 8);
     $Page->SetPager('Home', '{first}{prev}&nbsp;{liststart}{list}{listend}&nbsp;{next}{last}', array("listlong" => "6", "first" => "首頁", "last" => "尾頁", "prev" => " < ", "next" => " > ", "list" => "*", "disabledclass" => ""));
     $list = $this->exchange->relation(true)->where($where)->limit($Page->firstRow, $Page->listRows)->order($order)->select();
     $this->assign("list", $list);
     $this->assign('page', $Page->show("Home"));
     $this->display(':pointlist');
 }
開發者ID:noikiy,項目名稱:luokeke2,代碼行數:33,代碼來源:CenterController.class.php

示例12: _list

 /**
  * 列表數據
  * @param string  $model 	        模型
  * @param bool 	  $siteCharge  是否根據站點判斷,默認為false
  * @param array	  $extra	       額外字段,自帶字段:id,post_pic,post_title,post_url
  * @param array	  $extraWhere  查詢條件
  * @param int	  $count	        分頁條數,默認:16條
  */
 public function _list($model, $siteCharge = false, $extra = array(), $extraWhere = array(), $count = 16, $order = '')
 {
     $fieldArr = array("id", "post_pic", "post_title", "post_url");
     $whereArr = array_merge($extraWhere, array("status=1"));
     if ($siteCharge) {
         array_push($whereArr, "site_id={$this->siteId}");
     }
     if (!empty($extra)) {
         $fieldArr = array_merge($fieldArr, $extra);
     }
     $where = join(" and ", $whereArr);
     $field = join(",", $fieldArr);
     $order = empty($order) ? "listorder ASC,post_date DESC" : $order;
     // 導入分頁類
     import('Page');
     //總數
     $total = $model->where($where)->count();
     $Page = new \Page($total, $count);
     $Page->SetPager('Home', '{first}{prev}&nbsp;{liststart}{list}{listend}&nbsp;{next}{last}', array("listlong" => "6", "first" => "首頁", "last" => "尾頁", "prev" => " < ", "next" => " > ", "list" => "*", "disabledclass" => ""));
     $list = $model->field($field)->where($where)->order($order)->limit($Page->firstRow . ',' . $Page->listRows)->select();
     $Page->SetPager('Phone', '{list}', array("listlong" => "5", 'list' => '*', 'disabledclass' => ''));
     //手機分頁樣式
     $this->assign('phonepage', $Page->show('Phone'));
     $this->assign("list", $list);
     $this->assign('page', $Page->show("Home"));
 }
開發者ID:noikiy,項目名稱:luokeke2,代碼行數:34,代碼來源:IndexController.class.php

示例13: page

/**
* 分頁輸出
* @param type $Total_Size 總記錄數
* @param type $Page_Size 分頁大小
* @param type $Current_Page 當前頁
* @param type $listRows 顯示頁數
* @param type $PageParam 分頁參數
* @param type $PageLink 分頁鏈接
* @param type $Static 是否(偽)靜態
* @return \Page 
* 其他說明 :當開啟靜態的時候 $PageLink 傳入的是數組,數組格式
* array(
 "index"=>"http://www.85zu.com/192.html",//這種是表示當前是首頁,無需加分頁1
 "list"=>"http://www.85zu.com/192-{page}.html",//這種表示分頁非首頁時啟用
 )
*/
function page($Total_Size = 1, $Page_Size = 0, $Current_Page = 1, $listRows = 6, $PageParam = '', $PageLink = '', $Static = FALSE, $TP = "")
{
    static $_pageCache = array();
    $cacheIterateId = md5($Total_Size . $Page_Size . $Current_Page . $listRows . $PageParam);
    if (isset($_pageCache[$cacheIterateId])) {
        return $_pageCache[$cacheIterateId];
    }
    import('Page');
    if ($Page_Size == 0) {
        $Page_Size = C("PAGE_LISTROWS");
    }
    if (empty($PageParam)) {
        $PageParam = C("VAR_PAGE");
    }
    //生成靜態,需要傳遞一個常量URLRULE,來生成對應規則
    if (empty($PageLink) && $Static == true) {
        $P = explode("~", URLRULE);
        $PageLink = array();
        $PageLink['index'] = $P[0];
        $PageLink['list'] = $P[1];
    }
    if (empty($TP)) {
        $TP = '共有{recordcount}條信息&nbsp;{pageindex}/{pagecount}&nbsp;{first}{prev}&nbsp;{liststart}{list}{listend}&nbsp;{next}{last}';
    }
    $Page = new Page($Total_Size, $Page_Size, $Current_Page, $listRows, $PageParam, $PageLink, $Static);
    $Page->SetPager('default', $TP, array("listlong" => "6", "first" => "首頁", "last" => "尾頁", "prev" => "上一頁", "next" => "下一頁", "list" => "*", "disabledclass" => ""));
    $_pageCache[$cacheIterateId];
    return $Page;
}
開發者ID:BGCX262,項目名稱:ztoa-svn-to-git,代碼行數:45,代碼來源:common.php

示例14: page

function page($Total_Size = 1, $Page_Size = 0, $Current_Page = 1, $listRows = 6, $PageParam = '', $PageLink = '', $Static = FALSE)
{
    import('Page');
    if ($Page_Size == 0) {
        $Page_Size = C("PAGE_LISTROWS");
    }
    if (empty($PageParam)) {
        $PageParam = C("VAR_PAGE");
    }
    $Page = new \Page($Total_Size, $Page_Size, $Current_Page, $listRows, $PageParam, $PageLink, $Static);
    //	$Page->setLinkWraper('li');
    //	$Page->SetPager('home', '<ul class="pagination">{first}{prev}{liststart}{list}{listend}{next}{last} <div class="form">
    //								 		<span class="txt">到第</span>
    //								 		{jump}
    //								 		<span class="txt">頁</span>
    //								 		<span class="btn btn-sm submit">確定</span>
    //								 	</div></ul>', array("listlong" => "9", "first" => "首頁", "last" => "尾頁", "prev" => "上一頁", "next" => "下一頁", "list" => "*", "disabledclass" => ""));
    //$Page->setPager('home' , 'Tpl' => '', 'Config' => array()));
    $Page->SetPager('default', '<div class="item-page"><ul class="pagination"><li class="prev disabled">{prev}</li><li>{list}</li><li>{next}</li></ul>{jump}</div>', array("listlong" => "6", "first" => "首頁", "last" => "尾頁", "prev" => "<", "next" => ">", "list" => "*", "jump" => "input"));
    return $Page;
}
開發者ID:kmlzh1983,項目名稱:diamond,代碼行數:21,代碼來源:extend.php

示例15: sp_sql_goods_paged

/**
 * 商品列表,帶page
 * @ 處理標簽函數
 * @ $tag以字符串方式傳入,通過sp_param_lable函數解析為以下變量。例:"order:add_time desc,update_time desc;"
 * ids:調用指定id的一個或多個數據,如 1,2,3
 * field:調用goods指定字段,如(goods_id,goods_name...) 默認全部
 * limit:數據條數,默認值為10,可以指定從第幾條開始,如3,8(表示共調用8條,從第3條開始)
 * order:推薦方式(add_time) (desc/asc/rand())
 */
function sp_sql_goods_paged($tag, $pagesize = 20)
{
    $where = array();
    $tag = sp_param_lable($tag);
    $field = !empty($tag['field']) ? $tag['field'] : '*';
    $limit = !empty($tag['limit']) ? $tag['limit'] : '';
    $order = !empty($tag['order']) ? $tag['order'] : 'add_time';
    //根據參數生成查詢條件
    $where['goods_state'] = array('eq', 1);
    if (isset($tag['cid'])) {
        $where['term_id'] = array('in', $tag['cid']);
    }
    if (isset($tag['keywords'])) {
        $where['goods_name'] = array('like', "%" . $tag['keywords'] . "%");
    }
    if (isset($tag['ids'])) {
        $where['goods_id'] = array('in', $tag['ids']);
    }
    $goods = D("Goods");
    $totalsize = $goods->field($field)->where($where)->count();
    import('Page');
    if ($pagesize == 0) {
        $pagesize = 20;
    }
    $PageParam = C("VAR_PAGE");
    $page = new Page($totalsize, $pagesize);
    $page->setLinkWraper("li");
    $page->__set("PageParam", $PageParam);
    $page->SetPager('default', '<div class="page">{prev}&nbsp;&nbsp;{list}&nbsp;&nbsp;{listend}&nbsp;&nbsp;{next}</div>', array("listlong" => "6", "first" => "首頁", "prev" => "上一頁", "next" => "下一頁", "list" => "*", "disabledclass" => ""));
    $list = $goods->field($field)->where($where)->order($order)->limit($page->firstRow . ',' . $page->listRows)->select();
    $content['goods'] = $list;
    $content['count'] = $totalsize;
    $content['page'] = $page->show('default');
    return $content;
}
開發者ID:it114,項目名稱:public,代碼行數:44,代碼來源:function.php


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