On Nov 29, 6:52 pm, loki_mdog <[EMAIL PROTECTED]> wrote:
> Hey Folks, I have got paginating search results working...PERFECTLY!!! Took
> me long enough...anyway, I would like the have the pagination remember the
> filter terms (as it currently does) without having to make any modifications
> to the view.
>
> The code is here and listed a cakephp's bin (URL below):
>
> VIEW: this line makes the pagination URLs contain filters I need
> <?php $paginator->options(array('url' => $this->passedArgs));?>
>
> I want to remove the line above and get it in the controller and am combing
> the internets for an answer....many thanks.
>
> CONTROLLER
> function index() {
> $this->UserAction->recursive = 0;
>
> // holds the keyword filter
> $filter = "";
> // holds the conditions that should filter by
> $conditions = array();
>
> // filter by the data that is in the url string
> if(isset($this->passedArgs['param_filter'])){
> $filter = $this->passedArgs['param_filter'];
> }
>
> // filter by the data in the form field
> if($this->data['UserAction']['filter']){
> $filter = $this->data['UserAction']['filter'];
> }
>
> // set the data from the form field as something that will be in the
> url
> // so when URLs are constructed on the view, the filter will be
> there
> $this->passedArgs['param_filter'] = $filter;
>
> // do we have data to filter by
> if($filter){
> // if so, let's add this to the conditions array
> $conditions = array("UserAction.action = '$filter'");
> }
>
> // pagination criteria to filter by
> $this->paginate['UserAction'] = array(
> 'limit' => 10,
> 'order' => array ('UserAction.id' => 'asc'),
> 'conditions' => $conditions
> //'url' => array ('url' => 'testme')
> );
>
> // the result sets
> $this->set('userActions', $this->paginate());
> // pass the paramters to the view
> $this->set('param_filter', $filter);
>
> }
>
> http://bin.cakephp.org/view/602487164http://bin.cakephp.org/view/602487164
> --
> View this message in
> context:http://www.nabble.com/Paginating-search-results%2C-keeping-search-cri...
> Sent from the CakePHP mailing list archive at Nabble.com.
You seem to have solved the same problem I'm up against -
http://groups.google.com/group/cake-php/browse_frm/thread/c81f6bc4f4d10e33/6374f8d93e6c45d3?hl=en#6374f8d93e6c45d3
I've read your solution, but have to admit that I can't work out how
information is being passed between the controller and the view.
I wonder if you can help me get my app working in the same way?
Rob.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---