Friday, June 15, 2012

Re: CakeDC Search plugin for CakePhp 2.0, multiple models

try this one:

it can handle multiple fields across models for a like term etc

    'field' => array('Primary.field', 'Secondary.other_field')


Am Freitag, 15. Juni 2012 00:06:03 UTC+2 schrieb Bob Bowen:
Is there any way to make this work? As I understand it you have to enable Search.Searchable in the $actsAs, and define $filterArgs for each Model, then add Search.Prg to $components and define $presetVars in the Controller.

Then in your .ctp file you put something like this:

echo $this->Form->create('MyModel', array('url' => array_merge(array('action' => 'find'), $this->params['pass'])));
echo $this->Form->input('search', array('div' => false));
echo $this->Form->submit(__('Search', true), array('div' => false));
echo $this->Form->end();

But this allows you to search in one Model at a time. Is there any way to define a search form with one search field and have it look in various fields within various Models?

Thanks
Bob

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate