本文整理汇总了PHP中get_current_page函数的典型用法代码示例。如果您正苦于以下问题:PHP get_current_page函数的具体用法?PHP get_current_page怎么用?PHP get_current_page使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_current_page函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _requestListGet
/**
* Метод, предназначенный для получения и вывода списка Запросов
*
* @param boolean $pagination признак формирования постраничного списка
*/
function _requestListGet($pagination = true)
{
global $AVE_DB, $AVE_Template;
$limit = '';
// Если используется постраничная навигация
if ($pagination) {
// Определяем лимит записей на страницу и начало диапазона выборки
$limit = $this->_limit;
$start = get_current_page() * $limit - $limit;
// Получаем общее количество запросов
$num = $AVE_DB->Query("SELECT COUNT(*) FROM " . PREFIX . "_request")->GetCell();
// Если количество больше, чем установленный лимит, тогда формируем постраничную навигацию
if ($num > $limit) {
$page_nav = " <a class=\"pnav\" href=\"index.php?do=request&page={s}&cp=" . SESSION . "\">{t}</a> ";
$page_nav = get_pagination(ceil($num / $limit), 'page', $page_nav);
$AVE_Template->assign('page_nav', $page_nav);
}
$limit = $pagination ? "LIMIT " . $start . "," . $limit : '';
}
// Выполняем запрос к БД на получение списка запросов с учетом лимита вывода на страницу (если необходимо)
$items = array();
$sql = $AVE_DB->Query("\r\n\t\t\tSELECT *\r\n\t\t\tFROM " . PREFIX . "_request\r\n\t\t\tORDER BY Id ASC\r\n\t\t\t" . $limit . "\r\n\t\t");
// Формируем массив из полученных данных
while ($row = $sql->FetchRow()) {
$row->request_author = get_username_by_id($row->request_author_id);
array_push($items, $row);
}
// Возвращаем массив
return $items;
}
示例2: index
/**
* 返回国家列表
* @access public
*/
function index()
{
$country = get_post_value('country');
$region = get_post_value('region');
$province = get_post_value('province');
$city = get_post_value('city');
$field = array('country.country_id', 'country.country', 'region.region_id', 'region.region', 'province.province_id', 'province.province', 'city.city_id', 'city.city', 'city.status', 'city.orders');
// 排序方法2
$orderby = array('country.orders', 'region.orders', 'province.orders');
$m = new Address();
$m->clear();
$m->setField($field);
$m->setWhere('country.status', '!=', '50000');
$m->setWhere('region.status', '!=', '50000');
$m->setWhere('province.status', '!=', '50000');
$m->setWhere('city.status', '!=', '50000');
if ($country != '') {
$m->setWhere('country.country_id', '=', $country);
}
if ($region != '') {
$m->setWhere('region.region_id', '=', $region);
}
if ($province != '') {
$m->setWhere('province.province_id', '=', $province);
}
if ($city != '') {
$m->setWhere('city.city', 'LIKE', '%' . $city . '%');
}
$m->setTable('vcb_address_country AS country');
$m->setJoin('vcb_address_region as region', 'country.country_id=region.country_id');
$m->setJoin('vcb_address_province as province', 'region.region_id=province.region_id');
$m->setJoin('vcb_address_city as city', 'province.province_id=city.province_id');
$m->setOrderBy($orderby);
$count = $m->getRowsCount();
//合计计录数
//分页其他参数
$page = new Page($count);
$parameter = array('country' => get_post_value('country'));
$page->setParameter($parameter);
$showPage = $page->showPage();
$showTotal = $page->showTotal();
$m->setPage(get_current_page());
$data = $m->select();
//状态标题
$count = count($data);
for ($i = 0; $i < $count; $i++) {
$status = $data[$i]['status'];
$data[$i]['status_name'] = $m->getStatus($status);
}
$this->assign('data', $data);
//输出数据
$this->assign('showPage', $showPage);
//输出分页
$this->assign('showTotal', $showTotal);
//输出分页合计
$r = $m->getRegion($country);
$this->assign('region', $r);
$p = $m->getProvince($region);
$this->assign('province', $p);
}
示例3: render_ui
function render_ui($ui_page, $title = null)
{
$page =& get_current_page();
$renderer =& get_renderer();
$layout_page = load_layout_page($ui_page);
if ($layout_page !== null) {
if (empty($title)) {
$title = $page->title;
}
if (empty($title)) {
$title = $page->name;
}
$vars = new_global_wiki_variables();
$vars->set('title', $title);
$info_text = get_info_text();
if (count($info_text) > 0) {
$vars->set('info_text', implode(' ', $info_text));
}
$redirected_page =& get_redirected_page();
if ($redirected_page !== null) {
$vars->set('redir_page', $redirected_page->name);
}
$layout_page->render($vars);
}
}
示例4: do_pages
function do_pages($total, $page_size = 15)
{
global $db;
if ($total < $page_size) {
return;
}
$query = preg_replace('/page=[0-9]+/', '', $_SERVER['QUERY_STRING']);
$query = preg_replace('/^&*(.*)&*$/', "\$1", $query);
if (!empty($query)) {
$query = htmlspecialchars($query);
$query = "&{$query}";
}
$current = get_current_page();
$total_pages = ceil($total / $page_size);
echo '<div class="pages">';
if ($current == 1) {
echo '<span class="nextprev">«</span>';
} else {
$i = $current - 1;
echo '<a href="?page=' . $i . $query . '">«</a>';
}
echo '<span class="current">' . $current . '</span>';
if ($current < $total_pages) {
$i = $current + 1;
echo '<a href="?page=' . $i . $query . '">»</a>';
} else {
echo '<span class="nextprev">»</span>';
}
echo "</div>\n";
}
示例5: group_read
function group_read($from_where, $order_by)
{
global $db, $main_smarty, $view, $user, $rows, $page_size, $offset;
// figure out what "page" of the results we're on
$offset = (get_current_page() - 1) * $page_size;
// pagesize set in the admin panel
$search->pagesize = $page_size;
if ($order_by == "") {
$order_by = "group_date DESC";
}
include_once mnminclude . 'smartyvariables.php';
global $db, $main_smarty;
$rows = $db->get_var("SELECT count(*) FROM " . table_groups . " WHERE " . $from_where . " ");
$group = $db->get_results("SELECT distinct(group_id) as group_id FROM " . table_groups . " WHERE " . $from_where . " ORDER BY group_status DESC, " . $order_by . " LIMIT {$offset},{$page_size} ");
if ($group) {
foreach ($group as $groupid) {
$group_display .= group_print_summary($groupid->group_id);
}
$main_smarty->assign('group_display', $group_display);
}
if (Auto_scroll == 2 || Auto_scroll == 3) {
$main_smarty->assign("scrollpageSize", $page_size);
} else {
$main_smarty->assign('group_pagination', do_pages($rows, $page_size, "groups", true));
}
return true;
}
示例6: __construct
/**
* 架构函数
* @param array $totalRows 总的记录数
* @param array $listRows 每页显示记录数
* @param array $parameter 分页跳转的参数
*/
public function __construct($totalRows, $listRows = null, $parameter = array()) {
/* 基础设置 */
$this->_url = CURRENT_URL ;
$this->totalRows = $totalRows; //设置总记录数
$this->listRows = !isset($listRows) ? DEFAULT_LIMIT : $listRows; // 设置每页显示行数
$this->parameter = empty ( $parameter ) ? '' : $parameter;
$this->_currentPage = get_current_page();
$this->_currentPage = $this->_currentPage >0 ? $this->_currentPage :1;
}
示例7: include_template_part
/**
* @param string $include
* @param string $page (optional)
*/
function include_template_part($include, $page = "")
{
global $pwt;
if (!file_exists(dirname(__FILE__) . "/tpl/{$include}.php")) {
trigger_error("Template {$include}.php not found.", E_USER_WARNING);
return;
}
$page = $page === "" ? get_current_page() : explode("/", $page);
$home = get_relative_home_path($page);
include dirname(__FILE__) . "/tpl/{$include}.php";
}
示例8: doPages
function doPages($page_size, $thepage, $query_string, $total = 0)
{
//per page count
$index_limit = 5;
//set the query string to blank, then later attach it with $query_string
$query = '';
if (strlen($query_string) > 0) {
$query = "&" . $query_string;
}
//get the current page number example: 3, 4 etc: see above method description
$current = get_current_page();
$total_pages = ceil($total / $page_size);
$start = max($current - intval($index_limit / 2), 1);
$end = $start + $index_limit - 1;
$pagging = '<div class="paging">';
if ($current == 1) {
$pagging .= '<span class="prn">< Previous</span> ';
} else {
$i = $current - 1;
$pagging .= '<a class="prn" title="go to page ' . $i . '" rel="nofollow" href="' . $thepage . '?page=' . $i . $query . '">< Previous</a> ';
$pagging .= '<span class="prn">...</span> ';
}
if ($start > 1) {
$i = 1;
$pagging .= '<a title="go to page ' . $i . '" href="' . $thepage . '?page=' . $i . $query . '">' . $i . '</a> ';
}
for ($i = $start; $i <= $end && $i <= $total_pages; $i++) {
if ($i == $current) {
$pagging .= '<span>' . $i . '</span> ';
} else {
$pagging .= '<a title="go to page ' . $i . '" href="' . $thepage . '?page=' . $i . $query . '">' . $i . '</a> ';
}
}
if ($total_pages > $end) {
$i = $total_pages;
$pagging .= '<a title="go to page ' . $i . '" href="' . $thepage . '?page=' . $i . $query . '">' . $i . '</a> ';
}
if ($current < $total_pages) {
$i = $current + 1;
$pagging .= '<span class="prn">...</span> ';
$pagging .= '<a class="prn" title="go to page ' . $i . '" rel="nofollow" href="' . $thepage . '?page=' . $i . $query . '">Next ></a> ';
} else {
$pagging .= '<span class="prn">Next ></span> ';
}
//if nothing passed to method or zero, then dont print result, else print the total count below:
if ($total != 0) {
//prints the total result count just below the paging
$pagging .= '(' . $total . ' Records)';
}
$pagging .= '</div>';
return $pagging;
}
示例9: doPages
function doPages($page_size, $thepage, $query_string, $total = 0)
{
//per page count
$index_limit = 10;
//set the query string to blank, then later attach it with $query_string
$query = '';
if (strlen($query_string) > 0) {
$query = "&" . $query_string;
}
//get the current page number example: 3, 4 etc: see above method description
$current = get_current_page();
$total_pages = ceil($total / $page_size);
$start = max($current - intval($index_limit / 2), 1);
$end = $start + $index_limit - 1;
echo '<br /><br /><div class="paging">';
if ($current == 1) {
echo '<span class="prn">< Previous</span> ';
} else {
$i = $current - 1;
echo '<a href="' . $thepage . '?page=' . $i . $query . '" class="prn" rel="nofollow" title="go to page ' . $i . '">< Previous</a> ';
echo '<span class="prn">...</span> ';
}
if ($start > 1) {
$i = 1;
echo '<a href="' . $thepage . '?page=' . $i . $query . '" title="go to page ' . $i . '">' . $i . '</a> ';
}
for ($i = $start; $i <= $end && $i <= $total_pages; $i++) {
if ($i == $current) {
echo '<span>' . $i . '</span> ';
} else {
echo '<a href="' . $thepage . '?page=' . $i . $query . '" title="go to page ' . $i . '">' . $i . '</a> ';
}
}
if ($total_pages > $end) {
$i = $total_pages;
echo '<a href="' . $thepage . '?page=' . $i . $query . '" title="go to page ' . $i . '">' . $i . '</a> ';
}
if ($current < $total_pages) {
$i = $current + 1;
echo '<span class="prn">...</span> ';
echo '<a href="' . $thepage . '?page=' . $i . $query . '" class="prn" rel="nofollow" title="go to page ' . $i . '">Next ></a> ';
} else {
echo '<span class="prn">Next ></span> ';
}
//if nothing passed to method or zero, then dont print result, else print the total count below:
if ($total != 0) {
//prints the total result count just below the paging
echo '<p id="total_count">(total ' . $total_pages . ' page)</p></div>';
}
}
示例10: get_user_posts
function get_user_posts($user_id = 0)
{
global $conn;
$post_per_page = get_posts_per_page();
$current_page = get_current_page();
$offset = ($current_page - 1) * $post_per_page;
$posts_query = "SELECT *\n\t\tFROM posts\n\t\tWHERE user_id={$user_id}\n\t\tORDER BY publish_date DESC\n\t\tLIMIT {$offset}, {$post_per_page}";
$posts_query = mysqli_query($conn, $posts_query);
$all_posts = array();
// $counter = 0;
while ($post = mysqli_fetch_assoc($posts_query)) {
// $all_posts[$counter++] = $post;
$all_posts[] = $post;
}
return $all_posts;
}
示例11: document_pagination
/**
* Постраничная навигация документа
*
* @param string $text текст многострочной части документа
* @return string
*/
function document_pagination($text)
{
global $AVE_Core;
// IE8 <div style="page-break-after: always"><span style="display: none"> </span></div>
// Chrome <div style="page-break-after: always; "><span style="DISPLAY:none"> </span></div>
// FF <div style="page-break-after: always;"><span style="display: none;"> </span></div>
$pages = preg_split('#<div style="page-break-after:[; ]*always[; ]*"><span style="display:[ ]*none[;]*"> </span></div>#i', $text);
$total_page = @sizeof($pages);
if ($total_page > 1) {
$text = @$pages[get_current_page('artpage') - 1];
$page_nav = ' <a class="pnav" href="index.php?id=' . $AVE_Core->curentdoc->Id . '&doc=' . (empty($AVE_Core->curentdoc->document_alias) ? prepare_url($AVE_Core->curentdoc->document_title) : $AVE_Core->curentdoc->document_alias) . '&artpage={s}' . '">{t}</a> ';
$page_nav = get_pagination($total_page, 'artpage', $page_nav, get_settings('navi_box'));
$text .= rewrite_link($page_nav);
}
return $text;
}
示例12: rubricList
/**
* Вывод списка рубрик
*
*/
function rubricList()
{
global $AVE_DB, $AVE_Template;
$rubrics = array();
$num = $AVE_DB->Query("SELECT COUNT(*) FROM " . PREFIX . "_rubrics")->GetCell();
$page_limit = $this->_limit;
$seiten = ceil($num / $page_limit);
$set_start = get_current_page() * $page_limit - $page_limit;
if ($num > $page_limit) {
$page_nav = " <a class=\"pnav\" href=\"index.php?do=rubs&page={s}&cp=" . SESSION . "\">{t}</a> ";
$page_nav = get_pagination($seiten, 'page', $page_nav);
$AVE_Template->assign('page_nav', $page_nav);
}
$sql = $AVE_DB->Query("\r\n\t\t\tSELECT\r\n\t\t\t\trub.*,\r\n\t\t\t\tCOUNT(doc.Id) AS doc_count\r\n\t\t\tFROM\r\n\t\t\t\t" . PREFIX . "_rubrics AS rub\r\n\t\t\tLEFT JOIN\r\n\t\t\t\t" . PREFIX . "_documents AS doc\r\n\t\t\t\t\tON rubric_id = rub.Id\r\n\t\t\tGROUP BY rub.Id\r\n\t\t\tLIMIT " . $set_start . "," . $page_limit);
while ($row = $sql->FetchRow()) {
array_push($rubrics, $row);
}
$AVE_Template->assign('rubrics', $rubrics);
}
示例13: roadmapTaskList
/**
* Административная часть (задачи)
*/
function roadmapTaskList($tpl_dir, $project_id, $status)
{
global $AVE_DB, $AVE_Template;
$project_id = (int) $project_id;
$status = (int) $status;
$limit = $this->_limit;
$num = $AVE_DB->Query("\r\n\t\t\tSELECT COUNT(*)\r\n\t\t\tFROM " . PREFIX . "_modul_roadmap_tasks\r\n\t\t\tWHERE pid = '" . $project_id . "'\r\n\t\t\tAND task_status = '" . $status . "'\r\n\t\t")->GetCell();
$pages = ceil($num / $limit);
$start = get_current_page() * $limit - $limit;
$items = array();
$sql = $AVE_DB->Query("\r\n\t\t\tSELECT *\r\n\t\t\tFROM " . PREFIX . "_modul_roadmap_tasks\r\n\t\t\tWHERE pid = '" . $project_id . "'\r\n\t\t\tAND task_status = '" . $status . "'\r\n\t\t\tORDER BY priority\r\n\t\t\tLIMIT " . $start . "," . $limit);
while ($row = $sql->FetchRow()) {
$row->username = get_username_by_id($row->uid);
switch ($row->priority) {
case '1':
$row->priority = $AVE_Template->get_config_vars('ROADMAP_TASK_HIGHEST');
break;
case '2':
$row->priority = $AVE_Template->get_config_vars('ROADMAP_TASK_HIGH');
break;
case '3':
$row->priority = $AVE_Template->get_config_vars('ROADMAP_TASK_NORMAL');
break;
case '4':
$row->priority = $AVE_Template->get_config_vars('ROADMAP_TASK_LOW');
break;
case '5':
$row->priority = $AVE_Template->get_config_vars('ROADMAP_TASK_LOWEST');
break;
}
array_push($items, $row);
}
if ($num > $limit) {
$page_nav = " <a class=\"pnav\" href=\"index.php?do=modules&action=modedit&mod=roadmap&moduleaction=show_tasks&closed=" . $status . "&id=" . $project_id . "&cp=" . SESSION . "&page={s}\">{t}</a> ";
$page_nav = get_pagination($pages, 'page', $page_nav);
$AVE_Template->assign('page_nav', $page_nav);
}
$AVE_Template->assign('items', $items);
$AVE_Template->assign('content', $AVE_Template->fetch($tpl_dir . 'admin_tasks.tpl'));
}
示例14: get_page_nav
function get_page_nav()
{
global $smarty_q, $config_q;
$current_page = get_current_page();
$quotes_count = $smarty_q->get_template_vars("quotes_count");
$max_pages = floor($quotes_count / $config_q["quotes_on_page"]);
$start = $current_page - 10;
$end = $current_page + 10;
$pages = array();
$k = 1;
for ($i = $start; $i < $end; $i++) {
if ($i > 0 && $i <= $max_pages) {
$pages[$k] = array("caption" => $i, "index" => $k);
if ($i == $current_page) {
$pages[$k]["selected"] = true;
} else {
$pages[$k]["selected"] = false;
}
$k++;
}
}
return $pages;
}
示例15: sanitize
}
if (isset($_REQUEST['search'])) {
$search->filterToStatus = "all";
}
if (!isset($_REQUEST['search'])) {
$search->orderBy = "link_published_date DESC, link_date DESC";
}
if (isset($_REQUEST['tag'])) {
$search->searchTerm = sanitize($_REQUEST['search'], 3);
$search->isTag = true;
}
if (isset($thecat)) {
$search->category = $catID;
}
// figure out what "page" of the results we're on
$search->offset = (get_current_page() - 1) * $page_size;
// pagesize set in the admin panel
$search->pagesize = $page_size;
// since this is index, we only want to view "published" stories
$search->filterToStatus = "published";
// this is for the tabs on the top that filter
if (isset($_GET['part'])) {
$search->setmek = $db->escape($_GET['part']);
}
$search->do_setmek();
// do the search
$search->doSearch();
$linksum_count = $search->countsql;
$linksum_sql = $search->sql;
if (isset($_REQUEST['category'])) {
$category_data = get_cached_category_data('category_safe_name', sanitize($_REQUEST['category'], 1));