Other option possibly save the terms to a Search table and simply pass a
search_id so everything needed can be kept thru that. Other option save the
search query to the session? Just other options.

I have a single field Search which allows users to enter many terms so
remember that when 'Model.field LIKE' => '%' . $searchterm . '%')); might
not work as expected since users might enter more than 1 term. 

Keep that in mind also, you may need to re-work the query terms before
passing it off to find()

Note term length, someone searching for 'a' would return pointless results
possibly overkill on the db.

Good luck

From: [email protected] [mailto:[email protected]] On Behalf
Of Dee Johnson
Sent: Tuesday, February 08, 2011 5:34 PM
To: [email protected]
Subject: Re: Paginate Post Data

thanks for the quick reply but i found the answer while i was waiting on the
reply :)

In my way you do not have to use GET and the only thing you need to expose
to the URL is the term being searched for.

here is some code for anyone who may be needing this assistance.

Post search term to your controller via $this->data BUT then when you get
that information you take it and then REDIRECT to a search handler
controller. in my following example it will be defined as searchcomplete

//your regular search comes in

function index() {

        $searchterm =
$this->data['nameofyourmodel']['nameofyourformfield'];  //'
        
        $this->redirect(array('action' => 'searchcomplete/' . $searchterm));
//This assumes you are posting to an action in the same controller

}

function searchcomplete($searchterm = null) {  // have arguments to be able
to do some processing and filtering

// this is a VERY broken down version just the bare roots but you can take
it from here

$queryModel = $this->paginate('model', array('Model.field LIKE' => '%' .
$searchterm . '%')); 

//then send to the view as normal etc etc and do whatever else you want and
paginator should be fine now.

}
-- 
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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to