views:

20

answers:

1

What is the best way to paginate related data in Yii?

For example I may have post and I want to paginate comments.

+1  A: 

Hie, This can be achieved by using code like this, Suppose you have CommentController.php having,

function listComments(){

/*Write code here to fetch comments with current post from db & return template code via calling renderPartial(). Also implement paging, sorting etc. in this same function.*/

}

After that call this function in action for view post page & pass the comment's listing code in view post template.

Chetan sharma