本文整理汇总了PHP中Pager::getInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Pager::getInfo方法的具体用法?PHP Pager::getInfo怎么用?PHP Pager::getInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pager
的用法示例。
在下文中一共展示了Pager::getInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: template_simple
}
$limit = appconf('limit');
$q = db_query('SELECT * FROM digger_linkstory
WHERE status = "enabled" ' . $cat . '
ORDER BY posted_on desc, score desc');
if ($q->execute()) {
$total = $q->rows();
$res = $q->fetch($cgi->offset, $limit);
$q->free();
} else {
die($q->error());
}
// has voted?
foreach (array_keys($res) as $k) {
if (digger_has_voted($res[$k]->id)) {
$res[$k]->voted = 'style="display: none"';
}
}
// pager
loader_import('saf.GUI.Pager');
$pg = new Pager($cgi->offset, $limit, $total);
$pg->setUrl(site_prefix() . '/index/digger-app?category=' . $cgi->category);
$pg->getInfo();
// output
if (!empty($cgi->category)) {
page_title(appconf('digger_title') . ' - ' . db_shift('select category from digger_category where id = ?', $cgi->category));
} else {
page_title(appconf('digger_title'));
}
template_simple_register('pager', $pg);
echo template_simple('index.spt', array('category' => $cgi->category, 'results' => $res, 'banned_score' => appconf('ban_threshold')));
示例2: draw
function draw()
{
global $cgi;
if (!isset($cgi->orderBy)) {
$cgi->orderBy = array_shift(array_keys($this->fields));
}
if (!isset($cgi->sort)) {
$cgi->sort = 'asc';
}
if (!isset($cgi->offset)) {
$cgi->offset = 0;
}
$list = $this->getList();
if (!$list) {
return false;
}
if (!$this->primary_key) {
$this->primary_key = array_shift(array_keys($this->fields));
}
$this->list = array();
foreach ($list as $row) {
if (!is_object($row)) {
$row = (object) $row;
}
$this->list[$row->{$this->primary_key}] = $row;
}
$pg = new Pager($cgi->offset, $this->limit, $this->total);
$pg->setUrl(site_current() . '?orderBy=%s&sort=%s' . $this->rememberParams(), $cgi->orderBy, $cgi->sort);
$pg->getInfo();
$headers = array();
foreach ($this->fields as $name => $display) {
$headers[$name] = new TableHeader($name, $display);
}
$this->headers =& $headers;
$this->first_field = array_shift(array_keys($this->fields));
template_simple_register('pager', $pg);
return template_simple($this->template, $this);
}