本文整理汇总了PHP中AppController::paginate方法的典型用法代码示例。如果您正苦于以下问题:PHP AppController::paginate方法的具体用法?PHP AppController::paginate怎么用?PHP AppController::paginate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppController
的用法示例。
在下文中一共展示了AppController::paginate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: paginate
/**
* Overrides Controller::paginate() to set paging options in the
* Model::paginate property so they available in the Model::paginateCount()
* method. This is necessary due to the nature of having to paginate over a
* web service result set rather than a database result set.
*
* @param mixed $object
* @param mixed $scope
* @param mixed $whitelist
* @return array The result set
*/
public function paginate($object = null, $scope = array(), $whitelist = array())
{
// Manually put page, show & sort & direction params from URL if present in
// Controller::paginate
if (isset($this->passedArgs['page'])) {
$this->paginate['page'] = $this->passedArgs['page'];
}
if (isset($this->passedArgs['show'])) {
$this->paginate['limit'] = $this->passedArgs['show'];
}
if (isset($this->passedArgs['sort'])) {
$this->paginate['order'] = $this->passedArgs['sort'];
if (isset($this->passedArgs['direction'])) {
$this->paginate['order'] .= ' ' . $this->passedArgs['direction'];
}
}
// Merges the Controller::paginate paging params with the
// Controller::paginate[Model] paging params if present
$options = $this->paginate;
if (isset($options[$object])) {
$options = array_merge($options, $options[$object]);
unset($options[$object]);
}
// Set the merged paging options in the Model::paginate property, so they
// are available in Model::paginateCount() & Model::paginate() methods which
// handle pagination of a result set from the web service
$this->{$object}->paginate = $this->paginate[$object] = $options;
return parent::paginate($object, $scope, $whitelist);
}
示例2: paginate
/**
* Overrides Controller::paginate() to set paging options in the
* Model::paginate property so they available in the Model::paginateCount()
* method.
*
* @param mixed $object
* @param mixed $scope
* @param mixed $whitelist
* @return array The result set
*/
public function paginate($object = null, $scope = array(), $whitelist = array())
{
if (isset($this->passedArgs['page'])) {
$this->paginate['page'] = $this->passedArgs['page'];
}
if (isset($this->passedArgs['show'])) {
$this->paginate['limit'] = $this->passedArgs['show'];
}
$options = $this->paginate;
if (isset($options[$object])) {
$options = array_merge($options, $options[$object]);
unset($options[$object]);
}
$this->{$object}->paginate = $this->paginate[$object] = $options;
return parent::paginate($object = null, $scope = array(), $whitelist = array());
}
开发者ID:neilcrookes,项目名称:CakePHP-Yahoo-Geo-Planet-Plugin,代码行数:26,代码来源:yahoo_geo_planet_app_controller.php