How to limit the number of blogs displayed in one page. Yii 1 , PHP

I am able to display the blogs in one page, but I want to display only 5 blogs per page and display next 5 blogs on clicking next page button and so on.

Code in view file :


if (is_array($blogArticles) && count($blogArticles) > 0):

foreach ($blogArticles as $key => $blog_article):



<a href="#" style="color: black">

<?php print $blog_article['title']; ?>


Author : <?php print $blog_article['author']; ?>

<?php print $blog_article['published_date']; ?> 

<a href="<?php print Yii::app()->createUrl("//site/blogsingle" , array("id"=>$blog_article['id']))  ?>" class="btn btn-info" role="button">Read More</a>

Hi MukeshKoli,


The following link may help you to understand the concept of pagination using Yii framework!