Problème: lorsque j'ai un résultat de recherche avec pagination, les liens suivant, prev et les numéros ne conservent pas les paramètres de recherche. Semble être un problème commun.Cakephp 1.2 Paginator et PassedArgs
J'ai cherché partout sur Internet, et enfin je trouve que je dois mettre cette déclaration dans la vue:
$paginator->options(array('url' => $this->passedArgs));
Cependant, je ne peux pas le faire fonctionner, dois-je faire quelque chose $ this-> passedArgs dans le contrôleur?
S'il vous plaît aider
Merci
code du contrôleur:
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;
}
code de la vue:
<?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]