Pagination In View Of Yii

I have set pagination in controller for list view

but in demo blog app

how can we limit the posts comments in pagination.

Here is code

<?php $this->renderPartial('_comments',array(



		)); ?>

It actually call the file _comments.php in same folder. I want to show 10 comments and after that pagination start inside the post view file.

Any help please.


use CActiveDataProvider to get comments then give it to your view

//in your comment model in a function to get comments:

return $dataProvider = new CActiveDataProvider($this, array(

                                   'criteria' => $criteria, //if you have one.

				   'pagination' => array(

		                        'pageSize' => 10,



I know how to do it

i have my indexaction as

	public function actionIndex()


		$criteria=new CDbCriteria(array(


			'order'=>'t.status, t.create_time DESC',


		$dataProvider=new CActiveDataProvider('Comment', array(










Its working fine for list all modules

If you look at official blog demo of /view/posts

you will see a _comment.php file which is rendered as partial as below

<?php foreach($comments as $comment): ?>

<div class="comment" id="c<?php echo $comment->id; ?>">

	<?php echo CHtml::link("#{$comment->id}", $comment->getUrl($post), array(


		'title'=>'Permalink to this comment',

	)); ?>

	<div class="author">

		<?php echo $comment->name; ?> says:


	<div class="time">

		<?php echo date('F j, Y \a\t h:i a',$comment->create_time); ?>


	<div class="content">

		<?php echo nl2br(CHtml::encode($comment->content)); ?>


</div><!-- comment -->

<?php endforeach; ?>

and this file is called via

		<?php $this->renderPartial('_comments',array(



		)); ?>

There is no controller in between them.

any suggestions…