本文整理汇总了PHP中PSU::paginationResults方法的典型用法代码示例。如果您正苦于以下问题:PHP PSU::paginationResults方法的具体用法?PHP PSU::paginationResults怎么用?PHP PSU::paginationResults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PSU
的用法示例。
在下文中一共展示了PSU::paginationResults方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: channels
/**
* Portal Content browser
*/
public function channels($view = null, $page = 1)
{
if ($view == 'newest' || $view == 'popular') {
$channels = MyChannel::$view($this->portal->person);
} else {
$channels = MyChannel::fetchAll($this->portal->person);
}
$data = array();
foreach ($channels as $channel) {
if (ChannelAuthZ::_authz($channel->slug)) {
$data[] = $channel;
}
}
//end foreach
$per_page = 20;
$num_records = count($data);
$data = array_slice($data, ($page - 1) * $per_page, $per_page);
$overrides = array('last_page' => ceil($num_records / $per_page), 'total_records' => $num_records, 'num_rows' => count($data), 'rows_per_page' => $per_page, 'current_page' => $page);
$pagination = PSU::paginationResults(PSU::paginationInfo($_GET, $results, $overrides), $data);
$this->tpl->assign('channels', $pagination['items']);
$this->tpl->assign('pages', $pagination);
$this->tpl->assign('user_channels', MyChannel::fetchAll($this->person));
$this->tpl->display('channels.tpl');
}