CDbCriteria->limit and ->offset Problem

I am trying to use ‘limit’ and ‘offset’ with CDbCriteria but they are not being respected. I am basically just modifying the view code for the blog tutorial to limit the amount of posts shown in a widget. Here is my code:

        $criteria=new CDbCriteria(array(

                'select'=>'*,teaser as content',

                'condition'=>'status=' . Post::STATUS_PUBLISHED,



                'order'=>'update_time DESC',





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






Everything works properly except the limiting part. All posts are shown always. I am sure I am missing something basic but I just can’t see it

Thanks in Advance!

Someone has to have a solution for this problem. It seems like it should be so simple!

you need to set ‘pagination’=>false for offset/limit to work


check this thread:

Thank you so much. I figured it would be something simple.