Model::current
Set Current Page Parameter
Description
public self Model::current( [ int $current = 1 ] )
Sets the page that find returns. A value that is not a number, under 1 or over the last page gives page 1, so the request parameter can be passed as it is.
Arguments
| Name | Data type | Default | Remarks |
|---|---|---|---|
| $current | int | 1 | Current page number |
Example
Controller
$model = new Model(false, array(
'table' => 'cms_news',
'id' => 'news_id',
'visible' => 'visible',
));
// Page 2 of 5 rows (rows 6 to 10)
$records = $model->listMax(5)->current(2)->find();
// Page from the URL (?p=3)
$records = $model->listMax(5)->current($this->in('p'))->find();