本文整理汇总了PHP中Pager::build方法的典型用法代码示例。如果您正苦于以下问题:PHP Pager::build方法的具体用法?PHP Pager::build怎么用?PHP Pager::build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pager
的用法示例。
在下文中一共展示了Pager::build方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Exception
if ($db->forum_group > $acl->group) {
throw new Exception("Access denied");
}
echo "<span style='float:left; font-weight: normal;'><h2>" . $db->forum_name . "</h2></span>";
$this->setTitle($db->forum_name);
$db = new DB("forum_topics");
$db->setColPrefix("topic_");
$db->join("left", "{PREFIX}forum_posts", "post_topic", "topic_id");
$db->setSort("topic_sticky DESC, post_added DESC");
$db->select("topic_forum = '" . $db->escape($id) . "' GROUP BY post_topic");
$perpage = 40;
$pager = new Pager();
$pager->perpage = $perpage;
$pager->count = $db->numRows();
$pager->href = array("forums", "view-forum", $arg);
$pager->build();
echo $pager->pager_top;
?>
<br />
<a href="<?php
echo page("forums", "create-topic", "", "", "", "forum=" . $id);
?>
" style="float:right;"><span class="btn"><?php
echo _t("Create new topic");
?>
</span></a>
<br /><br />
<table width="100%" cellpadding="5" cellspacing="0" class="forum">
<thead>
<tr>
<td width="46px" class=""></td>
示例2: search
function search($page = 1, $searchQuery = null, $sort = "id")
{
$m = $this->model;
$temp = new $m();
$searchQueryParsed = Options::parse($searchQuery);
$where = array();
$queryData = new stdClass();
foreach ($searchQueryParsed as $key => $value) {
if (APP_USE_LANGUAGE) {
if ($value != "" && $value != null) {
if (isset($m->{$key})) {
$where[] = $temp->__table__ . ".{$key} LIKE \"%{$value}%\"";
} else {
$where[] = $temp->__table__ . ".{$key}_{$this->application->language} LIKE \"%{$value}%\"";
}
}
} else {
if ($value != "" && $value != null) {
$where[] = $temp->__table__ . ".{$key} LIKE \"%{$value}%\"";
}
}
$queryData->{$key} = $value;
}
$query = array();
//if($this->order!=null) $query["order"] = $this->order;
if ($sort != null) {
$query["order"] = "{$temp->__table__}.{$sort}";
}
$query["group"] = $temp->__table__ . ".id";
$query["limit"] = ($page - 1) * $this->perPage . "," . $this->perPage;
$query["founds"] = true;
if (count($where) > 0) {
$query["where"] = implode(" AND ", $where);
}
/*
if($condition!=null){
$query["where"] = $condition;
}
*/
$this->data["objects"] = Collection::load($this->model, $query, $total);
$order = new stdClass();
foreach ($this->orderFields as $key) {
$order->{$key} = $key;
$sym = $key . "symbol";
$order->{$sym} = "[asc]";
if ($key == $sort) {
$order->{$key} .= " desc";
$order->{$sym} = "[desc]";
}
}
$this->data["order"] = $order;
import("data.Pager");
$page = max($page, 1);
unset($this->data["objects"]["founds"]);
$pager = new Pager($total, $this->perPage);
$pager->to = "{$this->controller}/search/{page}/{$searchQuery}";
$this->data["pager"] = $pager->build($page);
$this->data["querydata"] = $queryData;
$this->data["uri"] = linkForm("/{$this->controller}/search/{$page}/{$searchQuery}");
$this->setView("{$this->folder}/{$this->subView}", $this->data);
}