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


PHP Pagination::getTotalCount方法代码示例

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


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

示例1: results

 public function results()
 {
     $id = $this->getParam(0, 0);
     $type_label = $this->getParam(1, 0);
     $page = !empty($this->getParam(2, 0)) ? (int) $this->getParam(2, 0) : 1;
     //$search_query = $this->request->get('q', '');
     $labels = Info::$type_labels;
     $type_label = ucfirst(str_replace('-', ' ', $type_label));
     $type = array_search($type_label, $labels);
     //$infos = Info::getElements($id, $type);
     /*
     $vars = array (
     	'id' => $id,
     	'type_label' => $type_label,
     	'infos' => $infos,
     	'labels' => $labels
     );
     */
     $sql = 'SELECT id, quarter_id, name, type, description, url, rating, theme FROM info WHERE quarter_id = :quarter_id AND type = :type ORDER BY id ASC';
     $bindings = array('quarter_id' => $id, 'type' => $type);
     $pagination = new Pagination($sql, $bindings, 16, $page - 1);
     $results = $pagination->getResults();
     foreach ($results as $result) {
         $infos[] = new Info($result);
     }
     //foreach ($infos as $key => $info) {
     //	$info->description=substr($info->description,0, 50);
     //}
     $vars = array('id' => $id, 'type_label' => $type_label, 'infos' => $infos, 'labels' => $labels, 'page' => $page, 'count_pages' => $pagination->getPagesCount(), 'count_total' => $pagination->getTotalCount());
     $this->render('elements', $vars);
 }
开发者ID:vincenthib,项目名称:visiteztokyo,代码行数:31,代码来源:ElementsController.class.php

示例2: results

 public function results()
 {
     $params = $this->getParams();
     $search_query = $this->request->get('q', '');
     $page = !empty($params[0]) ? (int) $params[0] : 1;
     $vars = array('title' => 'Search', 'description' => 'Description', 'page' => $page, 'count_pages' => 0, 'posts' => array(), 'count_total' => 0, 'search_query' => $search_query);
     if (!empty($search_query)) {
         $pagination = new Pagination('SELECT * FROM post WHERE title LIKE :search OR content LIKE :search ORDER BY date DESC', array(':search' => '%' . $search_query . '%'), 5, $page - 1);
         $vars = array_merge($vars, array('page' => $page, 'count_pages' => $pagination->getPagesCount(), 'posts' => $pagination->getResults(), 'count_total' => $pagination->getTotalCount()));
     }
     $this->render('search', $vars);
 }
开发者ID:erichub,项目名称:-Dashboard-Process,代码行数:12,代码来源:SearchController.class.php

示例3: results

 public function results()
 {
     $page = !empty($this->getParam(0, 0)) ? (int) $this->getParam(0, 0) : 1;
     //$pictures = Picture::getList('SELECT id, quarter_id, src, info_id, user_id FROM photo WHERE user_id IS NOT NULL ORDER BY id DESC');
     $sql = 'SELECT id, quarter_id, src, info_id, user_id FROM photo WHERE user_id IS NOT NULL ORDER BY id DESC';
     $bindings = array();
     $pagination = new Pagination($sql, $bindings, 20, $page - 1);
     $results = $pagination->getResults();
     foreach ($results as $result) {
         $pictures[] = new Picture($result);
     }
     $vars = array('pictures' => $pictures, 'page' => $page, 'count_pages' => $pagination->getPagesCount(), 'count_total' => $pagination->getTotalCount());
     $this->render('wall', $vars);
 }
开发者ID:vincenthib,项目名称:visiteztokyo,代码行数:14,代码来源:WallController.class.php

示例4: archives

 public function archives()
 {
     $params = $this->getParams();
     $date = !empty($params[0]) ? $params[0] : date('Y-m');
     $page = !empty($params[1]) ? (int) $params[1] : 1;
     $time = strtotime($date);
     $date_label = ucfirst(Lang::_(strtolower(date('F', $time)))) . ' ' . date('Y', $time);
     $pagination = new Pagination('SELECT * FROM post WHERE DATE_FORMAT(date, "%Y-%m") = :date ORDER BY date DESC', array(':date' => $date), 4, $page - 1);
     /*
     // Same with date split without mysql function DATE_FORMAT()
     $date_parts = explode('-', $date);
     $year = $date_parts[0];
     $month = $date_parts[1];
     
     $pagination = new Pagination('SELECT * FROM post WHERE YEAR(date) = :year AND MONTH(date) = :month ORDER BY date DESC', array(':year' => $year, ':month' => $month), 4, $page - 1);
     */
     $vars = array('title' => 'Title', 'description' => 'Description', 'date' => $date, 'date_label' => $date_label, 'page' => $page, 'count_pages' => $pagination->getPagesCount(), 'count_total' => $pagination->getTotalCount(), 'posts' => $pagination->getResults());
     $this->render('archives', $vars);
 }
开发者ID:vincenthib,项目名称:visiteztokyo,代码行数:19,代码来源:PostController.class.php

示例5: results

 public function results()
 {
     $params = $this->getParams();
     $quick_search = $this->request->get('qs');
     $advanced_search = $this->request->get('as');
     $search_query = $this->request->get('q', '');
     $quarter = $this->request->get('quarter', '');
     $type = $this->request->get('type', '');
     $theme = $this->request->get('theme', '');
     $page = !empty($params[0]) ? (int) $params[0] : 1;
     $infos = array();
     $quarters = Quarter::getList('SELECT id, name FROM quarter ORDER BY name ASC');
     $types = Info::$type_labels;
     $themes_query = Db::select('SELECT DISTINCT(theme) FROM info WHERE theme IS NOT NULL AND theme != "" ORDER BY theme');
     $themes = array();
     foreach ($themes_query as $row) {
         $_theme = $row['theme'];
         if (strpos($_theme, '|') !== false) {
             $theme_parts = explode('|', $_theme);
             foreach ($theme_parts as $_theme) {
                 if (!in_array($_theme, $themes)) {
                     $themes[] = $_theme;
                 }
             }
             continue;
         }
         $themes[] = $_theme;
     }
     $vars = array('title' => 'Search', 'description' => 'Description', 'quarters' => $quarters, 'types' => $types, 'themes' => $themes, 'page' => $page, 'count_pages' => 0, 'infos' => $infos, 'count_total' => 0, 'search_query' => $search_query, 'quarter' => $quarter, 'type' => $type, 'theme' => $theme, 'qs' => $quick_search, 'as' => $advanced_search);
     $sql = 'SELECT i.* FROM quarter q LEFT JOIN info i ON i.quarter_id = q.id WHERE 1 ';
     if (!empty($search_query)) {
         $sql .= 'AND (q.name LIKE :search OR q.description LIKE :search OR i.name LIKE :search OR i.description LIKE :search) ';
         $bindings = array('search' => '%' . $search_query . '%');
     }
     if (!empty($advanced_search)) {
         if (!empty($quarter)) {
             $sql .= 'AND q.id = :quarter ';
             $bindings['quarter'] = $quarter;
         }
         if (!empty($type)) {
             $sql .= 'AND i.type = :type ';
             $bindings['type'] = $type;
         }
         if (!empty($theme)) {
             $sql .= 'AND i.theme LIKE :theme ';
             $bindings['theme'] = '%' . $theme . '%';
         }
     }
     if (!empty($bindings)) {
         $pagination = new Pagination($sql, $bindings, 10, $page - 1);
         $results = $pagination->getResults();
         foreach ($results as $result) {
             $infos[] = new Info($result);
         }
         foreach ($infos as $key => $info) {
             $info->description = substr($info->description, 0, 200);
         }
         $vars = array_merge($vars, array('page' => $page, 'count_pages' => $pagination->getPagesCount(), 'infos' => $infos, 'count_total' => $pagination->getTotalCount()));
     }
     $this->render('search', $vars);
 }
开发者ID:vincenthib,项目名称:visiteztokyo,代码行数:61,代码来源:SearchController.class.php


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