How Post/admin Accept Param 'post_Page' In Blog Demo?

How post/admin accept param ‘Post_page’ in blog demo’s “Manage Posts”?I searched the code in PostController/actionAdmin and views/post/admin but found nothing.I want to know how post/admin accept that param and make pagination.

here’s my screenshot:



In your controller

public function actionAdmin()


		$model=new Company('search');


		$model->unsetAttributes();  // clear any default values




                // Here you can set that value    

                $model->Post_page = Yii::app()->request->getParam('Post_page');






In your model do like whatever you want to do

public function search()


    $criteria=new CDbCriteria;

    $criteria->compare('t.Post_page',      $this->Post_page);




Yes,I do know how to get a param that passed to controller/action,but I cannot find property ‘Post_page’ in the file models/Post.php from the “blog” demo provided by yiiframwork.So,I think it’s magic.

here is the zip package

has a pagination property it uses to get the value of page, Yii just makes it easy.

of course you can roll up your own pagination if you like

Hi aiddroid,

I myself don’t know the exact mechanism. But …

The links regarding the pagination are rendered on the page by the pager (usually a CLinkPager object) of the grid, normally in the form of ‘Model_page=xx’ in $_GET parameter. And when you hit that link, the requested page will be interpreted on the server by the data provider (usually a CActiveDataProvider) that provides the data to the grid. For both the rendering and the interpreting, Yii uses CPagination object to make and get the pagination information. The jobs are performed rather deep inside the CGridView or the CActiveDataProvider and you will not see them directly in the controller or the view.

Please read the relevant topics in the API reference, and the source code of them if you would like. I think it’s worth doing. :)

Thank all of you.