当前位置: 首页>>代码示例>>PHP>>正文


PHP Paging类代码示例

本文整理汇总了PHP中Paging的典型用法代码示例。如果您正苦于以下问题:PHP Paging类的具体用法?PHP Paging怎么用?PHP Paging使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Paging类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: exeAlbum

 function exeAlbum()
 {
     if (Session::get('user') != null) {
         Document::setTitle('Album ảnh');
         Document::setJs(array('image', 'jquery.form'));
         $data = array();
         $display = 15;
         $totalPage = ceil($this->model->total("`username` = '" . Session::get('user')['username'] . "'") / $display);
         if ((int) Request::get('page') > 0) {
             $page = Request::get('page');
             if ($totalPage < $page) {
                 $page = $totalPage;
             }
         } else {
             $page = 1;
         }
         $pageLink = new Paging($page, $totalPage);
         $data['pagination'] = $pageLink->pagination('?');
         $data['images'] = $this->model->selectUser(Session::get('user')['username'], ($page - 1) * $display, $display);
         $data['url'] = BASE_URL . '/';
         $data['action'] = BASE_URL . '/image/add';
         $this->view->render('album', $data);
     } else {
         Until::redirectTo();
     }
 }
开发者ID:noikiy,项目名称:lovetolove,代码行数:26,代码来源:Image.php

示例2: exeDefault

 public function exeDefault()
 {
     Document::setTitle('Quản lý ảnh');
     Document::setJs(array('jquery-1.8.3.min', 'image-admin'));
     $data = array();
     $keySearch = Request::get('keySearch');
     $data['keySearch'] = $keySearch;
     $condition = '';
     if ($keySearch == null) {
         $link = '?';
     } else {
         $link = '?keySearch=' . $keySearch . '&';
         $condition = 'LOWER(`username`)="' . strtolower($keySearch) . '"';
     }
     $display = 20;
     $totalPage = ceil($this->model->total($condition) / $display);
     if ((int) Request::get('page') > 0) {
         $page = Request::get('page');
         if ($totalPage < $page) {
             $page = $totalPage;
         }
     } else {
         $page = 1;
     }
     $pageLink = new Paging($page, $totalPage);
     $data['title'] = BASE_URL_ADMIN . '/image';
     $data['pagination'] = $pageLink->pagination($link);
     $data['images'] = $this->model->selectAll(($page - 1) * $display, $display, $condition);
     $data['ajax'] = BASE_URL_ADMIN . '/image/load';
     $data['imageLoad'] = BASE_URL . '/public/css/images/loading.gif';
     $data['url'] = BASE_URL . '/';
     $this->view->render('index', $data);
 }
开发者ID:noikiy,项目名称:lovetolove,代码行数:33,代码来源:Image.php

示例3: find

 public function find($string = '')
 {
     $this->searchTerms = array_filter(explode(' ', $string));
     if ($this->autocompleteField !== '') {
         $this->params['facet'] = 'on';
         if (!isset($this->params['facet.field'])) {
             $this->params['facet.field'] = array($this->autocompleteField);
         } else {
             $this->params['facet.field'][] = $this->autocompleteField;
         }
         $this->params['f.' . $this->autocompleteField . '.facet.sort'] = $this->autocompleteSort;
         $this->params['f.' . $this->autocompleteField . '.facet.limit'] = $this->autocompleteLimit;
         $this->params['f.' . $this->autocompleteField . '.facet.prefix'] = end($this->searchTerms);
         $this->params['f.' . $this->autocompleteField . '.facet.mincount'] = 1;
     }
     $response = $this->exec($this->buildQuery('standardQuery'));
     // PREPAIR PAGING
     if (isset($response->count) && isset($response->offset)) {
         $paging = new Paging($response->count, $this->params['rows'], null, $response->offset);
         foreach ($paging->calculate() as $key => $val) {
             $response->{$key} = $val;
         }
     }
     return $response;
 }
开发者ID:bfpi,项目名称:klarschiff-frontend,代码行数:25,代码来源:SolrClient.php

示例4: indexAction

 /**
  * 首页
  *
  * @author          mrmsl <msl-138@163.com>
  * @date            2013-04-28 17:14:18
  *
  * @return void 无返回值
  */
 public function indexAction()
 {
     $page_size = 60;
     $total = $this->_model->table(TB_TAG)->count('DISTINCT tag');
     $page_info = Filter::page($total, 'page', $page_size);
     $page = $page_info['page'];
     $page_one = $page < 2;
     $tag_arr = $this->_model->table(TB_TAG)->order('searches DESC')->field('DISTINCT `tag`')->limit($page_info['limit'])->select();
     $paging = new Paging(array('_url_tpl' => BASE_SITE_URL . 'tag/page/\\1.shtml', '_total_page' => $page_info['total_page'], '_now_page' => $page, '_page_size' => $page_size));
     $o = $this->getViewTemplate()->assign(array('web_title' => L('TAG'), 'tag_arr' => $tag_arr, 'paging' => $paging->getHtml(), 'page' => $page_one ? '' : $page));
     $this->_display(null, null, $page);
 }
开发者ID:yunsite,项目名称:yablog,代码行数:20,代码来源:TagController.class.php

示例5: news_admin_main

function news_admin_main()
{
    $paging = new Paging('p', _result_per_page(), 1, 9);
    $paging->sCurrentPageClass = 'current';
    $paging->sPageNextClass = 'next';
    $sqlOrder = 'news_id desc';
    if (!empty($_GET['sortby'])) {
        $sortby = $_GET['sortby'];
        $sort = $_GET['sort'];
        if ($sort == 'asc') {
            $sqlOrder = $sortby . ' asc';
        } else {
            if ($sort == 'desc') {
                $sqlOrder = $sortby . ' desc';
            }
        }
    }
    $sqlOrder = 'ordering DESC,is_category desc,' . $sqlOrder;
    $data = array();
    $db = _db();
    $pid = 0;
    $parent = null;
    if (!empty($_GET['pid'])) {
        $pid = $_GET['pid'];
        if ($pid != 0) {
            $db->prepare('SELECT news_id, parent_id FROM `_prefix_news` WHERE news_id=:ID');
            $db->bindValue(':ID', $pid, PARAM_INT);
            $db->execute();
            if ($parent = $db->fetch()) {
                $data['parent'] = $parent;
            } else {
                $pid = 0;
            }
        }
    }
    $cats[0] = '-- Không thuộc nhóm --';
    getCategoryList($cats);
    $data['category'] = $cats;
    $db->prepare('SELECT SQL_CALC_FOUND_ROWS ordering ,is_quantam, is_tieudiem,news_id, news_created, news_title, is_category, is_enabled, is_showintroimage,introimage FROM `_prefix_news` WHERE parent_id=:PARENT_ID ORDER BY :ORDER LIMIT :OFFSET, :TOTAL');
    $db->bindValue(':PARENT_ID', $pid, PARAM_INT);
    $db->bindValue(':ORDER', $sqlOrder, PARAM_NONE);
    $db->bindValue(':OFFSET', $paging->getResultRowStart(), PARAM_INT);
    $db->bindValue(':TOTAL', _result_per_page(), PARAM_INT);
    $db->execute();
    die('xyz');
    if ($items = $db->fetchAll()) {
        $data['items'] = $items;
    }
    //Lay tong cong so record
    $paging->nTotalRow = $db->total_last_limit_query();
    $data['paging'] = $paging;
    return $data;
}
开发者ID:quangbt2005,项目名称:vhost-kis,代码行数:53,代码来源:admin.news.php

示例6: exeDefault

 function exeDefault()
 {
     Document::setTitle('Liên hệ');
     Document::setJs(array('jquery-1.8.3.min', 'ask-delete', 'jconfirmaction.jquery', 'jquery.msgBox'));
     $data = array();
     $keySearch = Request::get('keySearch');
     $find = Request::get('find');
     $searchName = '';
     $searchEmail = '';
     if ($find == 'name') {
         $searchName = 'selected="selected"';
     } elseif ($find == 'email') {
         $searchEmail = 'selected="selected"';
     }
     $data['searchName'] = $searchName;
     $data['searchEmail'] = $searchEmail;
     $data['keySearch'] = $keySearch;
     $condition = '';
     if ($keySearch == null) {
         $link = '?';
     } else {
         $link = '?keySearch=' . $keySearch . '&';
         if ($searchEmail != '') {
             $condition = "LOWER(`email`) like '%" . strtolower($keySearch) . "%'";
         } else {
             $condition = "LOWER(`fullname`) like '%" . strtolower($keySearch) . "%'";
         }
         if ($find == 'email') {
             $link .= 'find=' . $find . '&';
         }
     }
     $display = 15;
     $totalPage = ceil($this->model->total($condition) / $display);
     if ((int) Request::get('page') > 0) {
         $page = Request::get('page');
         if ($totalPage < $page) {
             $page = $totalPage;
         }
     } else {
         $page = 1;
     }
     $pageLink = new Paging($page, $totalPage);
     $data['title'] = BASE_URL_ADMIN . '/feedback';
     $data['pagination'] = $pageLink->pagination($link);
     $data['actionDelete'] = BASE_URL_ADMIN . '/feedback/delete';
     $data['delete'] = BASE_URL_ADMIN . '/feedback/delete?id=';
     $data['detail'] = BASE_URL_ADMIN . '/feedback/detail?id=';
     $data['imageDelete'] = BASE_URL . '/public/css/images/trash.png';
     $data['feedback'] = $this->model->selectAll(($page - 1) * $display, $display, $condition);
     $this->view->render('index', $data);
 }
开发者ID:noikiy,项目名称:lovetolove,代码行数:51,代码来源:Feedback.php

示例7: _fetchBlog

 /**
  * 渲染博客列表
  *
  * @author          mrmsl <msl-138@163.com>
  * @date            2013-04-28 16:55:45
  *
  * @param string|array $cate_info 数组为分类,否则为标签
  *
  * @return void 无返回值
  */
 private function _fetchBlog($cate_info = null)
 {
     if (is_array($cate_info)) {
         //分类
         $is_tag = false;
         $cate_id = $cate_info['cate_id'];
         $table = TB_BLOG;
         $where = array('b.is_delete' => 0, 'b.is_issue' => 1);
         if ($cate_id) {
             //category.shtml
             $where['b.cate_id'] = array('IN', $this->_getChildrenIds($cate_id));
         }
         $url_tpl = str_replace('.shtml', '/page/\\1.shtml', $cate_info['link_url']);
         $cache_flag = $cate_id;
         $total = $this->_model->table(TB_BLOG)->alias('b')->where($where)->count();
         $this->_model->alias('b');
         //b.title
     } else {
         //标签
         $this->_model->table(TB_TAG)->where(array('tag' => $cate_info))->setInc('searches');
         //搜索次数+1
         $is_tag = true;
         $table = TB_BLOG . ' AS b JOIN ' . TB_TAG . ' AS t ON t.blog_id=b.blog_id';
         $where = array('t.tag' => array('IN', $cate_info), 'b.is_delete' => 0, 'b.is_issue' => 1);
         $url_tpl = BASE_SITE_URL . 'tag/' . urlencode($cate_info) . '/page/\\1.shtml';
         $cache_flag = md5(strtolower($cate_info));
         $total = $this->_model->table(TB_BLOG)->alias('b')->join(' JOIN ' . TB_TAG . ' AS t ON b.blog_id=t.blog_id')->where($where)->count('DISTINCT b.blog_id');
     }
     $page_info = Filter::page($total, 'page', PAGE_SIZE);
     $page = $page_info['page'];
     $page_one = $page < 2;
     $blog_arr = $this->_model->table($table)->where($where)->order('b.blog_id DESC')->limit($page_info['limit'])->field('b.blog_id,b.title,b.link_url,b.cate_id,b.add_time,b.summary,b.seo_keyword,b.seo_description')->select();
     $paging = new Paging(array('_url_tpl' => $url_tpl, '_total_page' => $page_info['total_page'], '_now_page' => $page, '_page_size' => PAGE_SIZE));
     $o = $this->getViewTemplate($page_one && !$is_tag ? 'build_html' : null)->assign(array('blog_arr' => $blog_arr, 'paging' => $paging->getHtml(), 'page' => $page_one ? '' : $page));
     if ($is_tag) {
         //标签
         $o->assign(array('web_title' => $cate_info . TITLE_SEPARATOR . L('TAG'), 'tag' => $cate_info, 'seo_keywords' => $cate_info));
     } else {
         //分类
         $o->assign(array('web_title' => $cate_id ? $this->nav($cate_id, 'cate_name', null, TITLE_SEPARATOR) : $cate_info['cate_name'], 'cate_info' => $cate_info, 'tag' => ''));
     }
     $content = $o->fetch(CONTROLLER_NAME, ACTION_NAME, $cache_flag . '-' . $page);
     if ($page_one && !$is_tag) {
         $filename = str_replace(BASE_SITE_URL, WWWROOT, $cate_info['link_url']);
         new_mkdir(dirname($filename));
         //file_put_contents($filename, $content);
     }
     echo $content;
 }
开发者ID:yunsite,项目名称:yablog,代码行数:59,代码来源:Category.class.php

示例8: exeDefault

 function exeDefault()
 {
     Document::setJs(array('jquery-1.8.3.min', 'ask-delete', 'jconfirmaction.jquery', 'role', 'type_user'));
     Document::setTitle('Quản lý thành viên');
     $data = array();
     $keySearch = Request::get('keySearch');
     $find = Request::get('find');
     $searchName = '';
     $searchEmail = '';
     if ($find == 'name') {
         $searchName = 'selected="selected"';
     } elseif ($find == 'email') {
         $searchEmail = 'selected="selected"';
     }
     $data['title'] = BASE_URL_ADMIN . '/user';
     $data['searchName'] = $searchName;
     $data['searchEmail'] = $searchEmail;
     $data['keySearch'] = $keySearch;
     $condition = '';
     if ($keySearch == null) {
         $link = '?';
     } else {
         $link = '?keySearch=' . $keySearch . '&';
         if ($searchEmail != '') {
             $condition = "LOWER(`email`) like '%" . strtolower($keySearch) . "%'";
         } else {
             $condition = "LOWER(`username`) like '%" . strtolower($keySearch) . "%'";
         }
         if ($find == 'email') {
             $link .= 'find=' . $find . '&';
         }
     }
     $display = 20;
     $totalPage = ceil($this->model->total($condition) / $display);
     if ((int) Request::get('page') > 0) {
         $page = Request::get('page');
         if ($totalPage < $page) {
             $page = $totalPage;
         }
     } else {
         $page = 1;
     }
     $pageLink = new Paging($page, $totalPage);
     $data['pagination'] = $pageLink->pagination($link);
     $data['user'] = $this->model->selectAll(($page - 1) * $display, $display, $condition);
     $data['action'] = '';
     $this->view->render('index', $data);
 }
开发者ID:noikiy,项目名称:lovetolove,代码行数:48,代码来源:User.php

示例9: indexAction

 /**
  * 首页
  *
  * @author          mrmsl <msl-138@163.com>
  * @date            2013-02-21 13:44:11
  *
  * @return void 无返回值
  */
 public function indexAction()
 {
     $total = $this->_model->table(TB_COMMENTS)->where($where = 'type=' . COMMENT_TYPE_GUESTBOOK . ' AND status=' . COMMENT_STATUS_PASS . ' AND parent_id=0')->count();
     $page_info = Filter::page($total, 'page', PAGE_SIZE);
     $page = $page_info['page'];
     $page_one = $page < 2;
     $guestbook_arr = $this->_model->table(TB_COMMENTS)->where($where)->order('last_reply_time DESC')->limit($page_info['limit'])->select();
     $paging = new Paging(array('_url_tpl' => BASE_SITE_URL . 'guestbook/page/\\1.shtml', '_total_page' => $page_info['total_page'], '_now_page' => $page, '_page_size' => PAGE_SIZE));
     $o = $this->getViewTemplate($page_one ? 'build_html' : null)->assign(array('web_title' => L('GUESTBOOK'), 'guestbook_html' => $this->_getRecurrsiveComments($guestbook_arr), 'paging' => $paging->getHtml(), 'page' => $page_one ? '' : $page));
     $content = $o->fetch(CONTROLLER_NAME, ACTION_NAME, $page);
     if ($page_one) {
         $filename = WWWROOT . 'guestbook.shtml';
         //file_put_contents($filename, $content);
     }
     echo $content;
 }
开发者ID:yunsite,项目名称:yablog,代码行数:24,代码来源:Guestbook.class.php

示例10: getTrashCommentsWithPagingForOwner

function getTrashCommentsWithPagingForOwner($blogid, $category, $name, $ip, $search, $page, $count)
{
    global $database;
    $sql = "SELECT c.*, e.title, c2.name AS parentName \n\t\tFROM {$database['prefix']}Comments c \n\t\tLEFT JOIN {$database['prefix']}Entries e ON c.blogid = e.blogid AND c.entry = e.id AND e.draft = 0 \n\t\tLEFT JOIN {$database['prefix']}Comments c2 ON c.parent = c2.id AND c.blogid = c2.blogid \n\t\tWHERE c.blogid = {$blogid} AND c.isfiltered > 0";
    $postfix = '';
    if ($category > 0) {
        $categories = POD::queryColumn("SELECT id FROM {$database['prefix']}Categories WHERE parent = {$category}");
        array_push($categories, $category);
        $sql .= ' AND e.category IN (' . implode(', ', $categories) . ')';
        $postfix .= '&amp;category=' . rawurlencode($category);
    } else {
        $sql .= ' AND (e.category >= 0 OR c.entry = 0)';
    }
    if (!empty($name)) {
        $sql .= ' AND c.name = \'' . POD::escapeString($name) . '\'';
        $postfix .= '&amp;name=' . rawurlencode($name);
    }
    if (!empty($ip)) {
        $sql .= ' AND c.ip = \'' . POD::escapeString($ip) . '\'';
        $postfix .= '&amp;ip=' . rawurlencode($ip);
    }
    if (!empty($search)) {
        $search = escapeSearchString($search);
        $sql .= " AND (c.name LIKE '%{$search}%' OR c.homepage LIKE '%{$search}%' OR c.comment LIKE '%{$search}%')";
        $postfix .= '&amp;search=' . rawurlencode($search);
    }
    $sql .= ' ORDER BY c.written DESC';
    list($comments, $paging) = Paging::fetch($sql, $page, $count);
    if (strlen($postfix) > 0) {
        $paging['postfix'] .= $postfix . '&amp;withSearch=on';
    }
    return array($comments, $paging);
}
开发者ID:hinablue,项目名称:TextCube,代码行数:33,代码来源:blog.trash.php

示例11: indexAction

 /**
  * 首页
  *
  * @author          mrmsl <msl-138@163.com>
  * @date            2013-02-21 13:30:55
  *
  * @return void 无返回值
  */
 public function indexAction()
 {
     $total = $this->_model->count();
     $page_info = Filter::page($total, 'page', PAGE_SIZE);
     $page = $page_info['page'];
     $page_one = $page < 2;
     $blog_arr = $this->_model->order('blog_id DESC')->limit($page_info['limit'])->select();
     $paging = new Paging(array('_url_tpl' => BASE_SITE_URL . 'miniblog/page/\\1.shtml', '_total_page' => $page_info['total_page'], '_now_page' => $page, '_page_size' => PAGE_SIZE));
     $o = $this->getViewTemplate($page_one ? 'build_html' : null)->assign(array('web_title' => L('MINIBLOG'), 'blog_arr' => $blog_arr, 'paging' => $paging->getHtml(), 'page' => $page_one ? '' : $page));
     $content = $o->fetch(CONTROLLER_NAME, ACTION_NAME, $page);
     if ($page_one) {
         $filename = WWWROOT . 'miniblog.shtml';
         //file_put_contents($filename, $content);
     }
     echo $content;
 }
开发者ID:yunsite,项目名称:yablog,代码行数:24,代码来源:MiniblogController.class.php

示例12: __constructor

 /**
  * 构造查询对象
  * @param null $paging
  */
 function __constructor($paging = null)
 {
     $this->isPaging = isset($paging);
     $this->paging = isset($paging) ? $paging : Paging::create();
     $this->parameters = array();
     $this->operators = array();
 }
开发者ID:xlwmin,项目名称:confusion,代码行数:11,代码来源:Query.php

示例13: prepare

 public function prepare($db)
 {
     $this->paging = Paging::getFromUrl();
     $this->paging->limit = $this->page_size;
     Paging::$max_pages_links = $this->max_pages_links;
     $this->search = isset($_GET['s']) ? $_GET['s'] : '';
     // add filtering logic here
     $this->data = ModelBase::select($db, $this->name, $this->where, $this->bindings, $this->types, $this->paging, $this->orderby);
 }
开发者ID:lotcz,项目名称:zshop,代码行数:9,代码来源:tables.php

示例14: getNoticesWithPaging

function getNoticesWithPaging($blogid, $search, $page, $count)
{
    $context = Model_Context::getInstance();
    $pool = getDefaultDBModelOnNotice($blogid);
    if ($search !== true && $search) {
        $search = escapeSearchString($search);
        $pool->setQualifierSet(array("title", "like", $search, true), "OR", array("content", "like", $search, true));
    }
    return Paging::fetch($pool, $page, $count, $context->getProperty("uri.folder") . "/" . $context->getProperty("suri.value"));
}
开发者ID:webhacking,项目名称:Textcube,代码行数:10,代码来源:notice.php

示例15: getKeywordsWithPaging

function getKeywordsWithPaging($blogid, $search, $page, $count)
{
    global $database, $folderURL, $suri;
    $aux = '';
    if ($search !== true && $search) {
        $search = POD::escapeString($search);
        $aux = "AND (title LIKE '%{$search}%' OR content LIKE '%{$search}%')";
    }
    $visibility = doesHaveOwnership() ? '' : 'AND visibility > 0';
    $sql = "SELECT * \n\t\tFROM {$database['prefix']}Entries \n\t\tWHERE blogid = {$blogid} \n\t\t\tAND draft = 0 {$visibility} \n\t\t\tAND category = -1 {$aux} \n\t\tORDER BY published DESC";
    return Paging::fetch($sql, $page, $count, "{$folderURL}/{$suri['value']}");
}
开发者ID:hinablue,项目名称:TextCube,代码行数:12,代码来源:blog.keyword.php


注:本文中的Paging类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。