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,

                'limit'=>2,

                'offset'=>0,

                'order'=>'update_time DESC',

                'with'=>'commentCount' 

        ));




        if(isset($_GET['tag']))

                $criteria->addSearchCondition('tags',$_GET['tag']);


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

                'pagination'=>array(

                        'pageSize'=>Yii::app()->params['postsPerPage'],

                ),

                'criteria'=>$criteria,

        ));



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

Edit:

check this thread: http://www.yiiframework.com/forum/index.php?/topic/7402-problem-with-cactivedataprovider/page__hl__limit%20pagination__fromsearch__1

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