This is the solution I know, I believe there is[are] other sulution [s]....I just can't figure out now.... :) This assumse that search form using method 'POST', and search function doest not have parameter; "function search() { ....". If you wanna maintain the parameter; "function search($category=null) { ....", or form use 'GET' method; just replace variable: "$this- >params['form']['input_search_form']" to "$category".
in the controller : ================== .... $keyword = (isset($this->params['named']['keyword']) && strlen($this- >params['named']['keyword']) >= 3) ? $this->params['named'] ['keyword'] : ((isset($this->params['form']['input_search_form']) && strlen($this->params['form']['input_search_form']) >= 3) ? $this- >params['form']['input_search_form'] : ''); $conditions = (isset($keyword) && $keyword != '') ? array ('Cat.category' => $keyword) : array("1 = 1")); $this->paginate = array( 'conditions' => $conditions, 'limit' => 10, 'order' => array ('Cat.id' => 'desc') ); $data = $this->paginate('Cat'); $this->set(compact('data','keyword')); .... in the view : =============== .... $paginator->options(array('url'=>array_merge(array('keyword'=> $keyword),$this->passedArgs)));?> ..... Hope this help you.... ==== Asmud ==== On Nov 17, 12:07 am, Sunchaser <mik342...@yahoo.it> wrote: > Problem: when i have a search resultset with pagination, the links > next, prev and numbers do not keep the search parameters. > > I searched everywhere, and at last i found that i should put this > statement in the view > > $paginator->options(array('url' => $this->passedArgs)); > > However, i can't make it work, Should i do somthing on $this- > > >passedArgs in the controller? > > Please help > > Thanks > > controller code: > ----------------------------------------------- > function search($category=null) > { > $this->paginate['Cat'] = array( > 'limit' => 10, > 'order' => array ('Cat.id' => 'desc') > ); > > $conditions = array('Cat.category' => $this->data['Cat'] > ['category']); > $this->set( 'data', $this->paginate('Cat', $conditions ) ); > $this->render( 'index_ar' ); > > return; > > } > > view code: > > <?php > $paginator->options(array('url' => $this->passedArgs)); > echo $paginator->numbers( ); > ?> > > <table class='grid'> > <tr> > <th><?php echo $paginator->sort('ID', 'id'); ?></th> > <th><?php echo $paginator->sort('Nome', 'name'); ?></th> > <th><?php echo $paginator->sort('Categoria', 'category'); ?></th> > <th>Foto</th> > <th><?php echo $paginator->sort('Stato', 'status'); ?></th> > <th width='25%'></th> > </tr> > <?php $i = '0'; $count = '1';?> > <?php foreach ($data as $cats): ?> > <?php $class = (is_int($i/2)) ? 'data-grid-row-1' : > 'data-grid- > row-2';?> > <tr class="<?php echo $class?>"> > <td><?php echo $cats['Cat']['id'] ?></td> > <td><?php echo $cats['Cat']['name'] ?></td> > <td><?php echo $cats['Cat']['category'] ?></td> > <td style='width:25px'> > > [cut] -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-...@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=.