本文整理匯總了PHP中Projects::paginate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Projects::paginate方法的具體用法?PHP Projects::paginate怎麽用?PHP Projects::paginate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Projects
的用法示例。
在下文中一共展示了Projects::paginate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: filterAction
/**
* Filter action
*
* This action is called through ajax on filter change like tags & order
*
* @access public
* @return void
*
* @author Ole Aass <ole.aass@gmx.com>
*/
public function filterAction()
{
if ($this->request->isPost() && $this->request->isAjax()) {
$tags = $this->request->getPost('tags');
$currentPage = $this->request->getPost('page', 'int');
$counter = $this->request->getPost('counter', 'int');
$projects = new Projects();
if (empty($tags)) {
$list = $projects->findAll();
} else {
$tags = array_keys($tags);
$list = $projects->findByTags($tags);
}
$page = $projects->paginate($list, $currentPage, $counter);
$page->counter = $counter;
$this->view->setVar('page', $page);
$this->view->partial('index/projects');
}
}
示例2: paginateByGroup
/**
* Paginate projects by group
*
* @param ProjectGroup $group
* @param integer $page
* @param integer $per_page
* @return array
*/
function paginateByGroup($group, $page = 1, $per_page = 10)
{
return Projects::paginate(array('conditions' => array('group_id = ? AND type = ?', $group->getId(), PROJECT_TYPE_NORMAL), 'order_by' => 'created_on DESC'), $page, $per_page);
}