Model::current
現在のページを設定します
説明
public self Model::current( [ int $current = 1 ] )
findが返すページを設定します。数値でない値、1未満の値、最後のページを超える値は1ページ目として扱うので、リクエストのパラメーターをそのまま渡せます。
引数
| 名前 | データ型 | デフォルト | 備考 |
|---|---|---|---|
| $current | int | 1 | 現在のページ番号 |
例
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();