/** * 构造查询对象 * @param null $paging */ function __constructor($paging = null) { $this->isPaging = isset($paging); $this->paging = isset($paging) ? $paging : Paging::create(); $this->parameters = array(); $this->operators = array(); }
$where .= "AND `date` >= '{$_GET['from']}' "; $qpage .= "&from={$_GET['from']}"; } if (isset($_GET['to']) && $_GET['to'] != '') { $where .= "AND `date` <= '{$_GET['to']}' "; $qpage .= "&to={$_GET['to']}"; } if (isset($_GET['status']) && $_GET['status'] != '') { $status = Typo::int($_GET['status']); $where .= "AND `status` LIKE '%%{$status}%%' "; $qpage .= "&status={$status}"; } $max = "15"; if (isset($_GET['paging'])) { $paging = Typo::int($_GET['paging']); $offset = ($paging - 1) * $max; } else { $paging = 1; $offset = 0; } $data['posts'] = Db::result("SELECT * FROM `posts` \n WHERE `type` = 'page' {$where} \n ORDER BY `date` DESC \n LIMIT {$offset},{$max}"); $data['num'] = Db::$num_rows; Theme::admin('header', $data); System::inc('pages', $data); Theme::admin('footer'); $page = array('paging' => $paging, 'table' => 'posts', 'where' => "`type` = 'page'" . $where, 'max' => $max, 'url' => 'index.php?page=pages' . $qpage, 'type' => 'pager'); echo Paging::create($page); break; } /* End of file pages.control.php */ /* Location: ./inc/lib/Control/Backend/pages.control.php */
* @copyright 2014-2015 Puguh Wijayanto * @license http://www.opensource.org/licenses/mit-license.php MIT * */ $post = ""; $data['max'] = Options::get('post_perpage'); if (isset($_GET['paging'])) { $paging = Typo::int($_GET['paging']); if ($paging > 0) { $offset = ($paging - 1) * $data['max']; } else { $offset = 0; } $pagingtitle = " - Page {$paging}"; } else { $offset = 0; $paging = 1; $pagingtitle = ""; } //echo $paging; $data['sitetitle'] = Site::$slogan . $pagingtitle; $data['posts'] = Db::result(sprintf("SELECT * FROM `posts` \n WHERE `type` = 'post' \n AND `status` = '1'\n ORDER BY `date` \n DESC LIMIT %d, %d", $offset, $data['max'])); $data['num'] = Db::$num_rows; $url = SMART_URL ? Site::$url : Site::$url . '/index.php?'; $paging = array('paging' => $paging, 'table' => 'posts', 'where' => '`type` = \'post\'', 'max' => $data['max'], 'url' => $url, 'type' => Options::get('pagination')); $data['paging'] = Paging::create($paging, SMART_URL); Theme::theme('header', $data); Theme::theme('index', $data); Theme::footer(); /* End of file default.control.php */ /* Location: ./inc/lib/Control/Frontend/default.control.php */
?> <?php #页眉 ////////////////////////////////////////////////////////////////////////////////////////////// include_once "include/header.php"; ?> <table> <tbody> <?php include_once "framework/Database.php"; include_once "framework/Paging.php"; include_once "framework/Query.php"; include_once "framework/Service/CstKlassService.php"; $paging = Paging::create(1); $query = new Query($paging); echo CstKlassService::count($query); $results = CstKlassService::results($query); foreach ($results as $item) { ?> <tr> <td><?php echo $item->getId(); ?> </td> <td><?php echo $item->getTble(); ?> </td> <td><?php
if (isset($_GET['from']) && $_GET['from'] != '') { $where .= "AND `join_date` >= '{$_GET['from']}' "; $qpage .= "&from={$_GET['from']}"; } if (isset($_GET['to']) && $_GET['to'] != '') { $where .= "AND `join_date` <= '{$_GET['to']}' "; $qpage .= "&to={$_GET['to']}"; } if (isset($_GET['status']) && $_GET['status'] != '') { $where .= "AND `status` LIKE '%%{$_GET['status']}%%' "; $qpage .= "&status={$_GET['status']}"; } $max = "10"; if (isset($_GET['paging'])) { $paging = Typo::int($_GET['paging']); $offset = ($paging - 1) * $max; } else { $paging = 1; $offset = 0; } $data['usr'] = Db::result("SELECT * FROM `user` WHERE {$where} ORDER BY `userid` ASC LIMIT {$offset}, {$max}"); $data['num'] = Db::$num_rows; $page = array('paging' => $paging, 'table' => 'user', 'where' => $where, 'max' => $max, 'url' => 'index.php?page=users' . $qpage, 'type' => 'pager'); $data['paging'] = Paging::create($page); Theme::admin('header', $data); System::inc('user', $data); Theme::admin('footer'); break; } /* End of file users.control.php */ /* Location: ./inc/lib/Control/Backend/users.control.php */