开发者

CakePHP Filter Search

I need to build a filter search that returns 开发者_如何学Pythondata using the criteria set. My problem is building the search. It needs to be a OR query because anyone of them could be selected.

http://img200.imageshack.us/img200/2527/screenshot20100118at095.png

This is what will be searched.

Accommodation.space Accommodation.room_type Accommodation.facilities Accommodation.speaks

The only way I can think of doing it is an if statement for each input, but that would be 15 if statements, is there a better way?


$Model->postConditions($this->data) [reference] can do this for you.

It will auto-generate Cake compatable conditions array, and you can even specify if you want it to be an "AND/OR" operation


This is a nice component which could likely be tweaked to work for you. It might even work right "out of the box"

http://www.jamesfairhurst.co.uk/posts/view/cakephp_filter_component/


Here is a new tutorial about this. Might help: http://www.youtube.com/watch?v=FAVuLXFVaCw

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜