CListView pre filter


I am new to Yii, so maybe this is a stupid question…

I play with the BLOG demo to learn yii.

Everything works fine and I want to achieve now that only those posts are shown in the index view, which have inside the database table in the column "active" the value "1".

Inside the Post Model, there is a section for the search where I could add a compare criteria, but that one is only used then for the search and for the admin (manage) link.

How can I do this with the index page?

Thanks for any hints that put me in the right direction…


You may filter it in you CActiveDataProvider that is used to fetch data in your index action.


yes that was the point I was missing.