Search Results with Refine results module

I am creating a website where I will have Search results of various people as per various fields and I want to have a refine results module on that page where the results can be refined as per the categories,

How can I do that in yii as I am very new in yii is there an example or tutorial.

It’s difficult to understand exactly what you want to do, but CGridView is very good for filtering search results. The documentation is here. An example of how to use CGridView can be found when you use Gii to generate CRUD for a model, in the manage page.

If you post some details of your models, and exactly what you are trying to search for, and how you are trying to refine the searches then we will be able to give more specific help.

Similar to what we have on this page

Well probably the best way to do that would be to extend CFormModel to include all the fields you want, and then link that to a CActiveForm on your page (on the left in this case) with all the fields in it. Then you can have a filter button submit the form, or have onchange for each element submit the form if you want to do it instantly (or through ajax if you like). At the controller end you can use CDbCriteria to add all the filters from the form to a query, and then use the CActiveDataProvider to display the results however you like.

You can see how to use CDbCriteria from the search() function Gii generates in models.

A little trickier would be to have filter checkboxes generated from another table, or on the fly somehow else, but as long as you only want a limited number of them you can still use the same method (setting the attribute names in the model to e.g. ‘checkbox1’, and using the value of the checkbox to send information about what it means to the model). If you want a potentially infinite number of checkboxes then you wouldn’t be able to use CActiveForm in the same way, you would have to name them with increasing numbers, and have the controller loop through the form and add directly to the CDbCriteria from that.

Thanks,

I have just found this website made in yii with something similar to what I want

Can anybody tell me how stay.com has its search feature

hi,

anybody did refine search ?

i really eager to know how it can be done.

thanks.

renruhak.

Basically you just take basic criteria and add some extra conditions.

hi,

thanks for the reply,

its ok but here i am asking for the front end.

how it is possible to develop checkboxlist and onclicking it shows progress image than the result.

good day,

renruhak