Hello,

I wanted to ask for suggestions regarding a search page.

I have a DB with articles which belongsTo authors and HABTM
categories.

I want a simple search box with some category check boxes, where I can
search for the given words. Now I have a $this->paginate with two
models. Like :

$this->paginate = array(
                                'Article'=>array(
                                                        'limit' => 
$this->_limit,
                                                        'conditions' => array(
                                                                                
'OR' => $searchArrayOR),
                                                        
'contain'=>array('UserUpload','Translation','Category','Author')
                        ),
                                'ArticlesCategory' =>array(
                                                        'limit' => 
$this->_limit,
                                                        'recursive' => 1,
                                                        'conditions' =>  array(
                                                                'AND' => 
array('Category.id' => $caategoryIN),
                                                                'OR' => 
$searchArrayOR),
                                                        'contain' => 
array('Category','Article','Article.Author',
                                                                        
'Article.UserUpload','Article.UserTranslated')
                        )
                        );

If a user has checked on or more categories I paginate
ArticlesCategory, else Articles.

If I want to search also in Authors than I should create another
pagination model. But instead of this isn't it better to run a custom
query with the apropriate joins? An in case of a custom query how can
I employ pagination using the pagination helper?

How do you cope with such searches?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to