Use criteria directly in the model

Hello!

I have generated the beginner webapp and used gii to create a list with my database columns.

Everything works great so far.

Now to the problem, I want to create a criteria to exclude some rows in the table. I have searched a lot on the web and I have found solutions like this: $post=Post::model()->find());

But that don’t seem to work on the “manage list” page gii created for me.

The model gii created for me just grabs everything from the database table, is there any way you can exclude rows directly in the model?

Thanks in advance.

Are you talkin about the "admin" view?

In that case, you can specify static an attribute value in the controller’s actionAdmin() method, or if it’s more specific comparison, adapt the model’s search() method accordingly.

Yes, I was talking about the admin page.

I inserted the criterias in the search() function and it worked, thanks alot!