Hello ...
I'm currently dealing with the same issue so I can share what've found
out and where I'm still stuck ... well, not really stuck, more where
my solution is not as neat as I'd like it to be.
In your controller you have to catch the filter, haven't found out how
to pass this automatically ... in this example I only want to show a
selected part group
if ([EMAIL PROTECTED]($this->passedArgs['partgroup_id']))
{
$this->paginate['conditions'] = array('partgroup_id' =>
$this->passedArgs['partgroup_id']);
}
In you view you'll need
$paginator->options(array('url' => $this->passedArgs));
This adds the passed arguments (partgroup_id:2) to the sort, prev, etc
links
The filter itself is created with (or you could use a select box of
course)
foreach ($partgroups as $key => $value)
{
echo "<li>";
echo $paginator->link($value,array("partgroup_id"=>$key));
echo "</li>";
}
That all works ok, what I'm still trying to find out is the following:
After editing/adding/deleting an entry, I want the filter criteria to
persist, ie I want the same page to be displayed.
Now from the pagination tutorial on the bakery I know I can solve this
by saving $this->paginator in a session and restoring it in index()
but this is not perferct since
if ($this->Session->check("rememberpaginate"))
{
$this->paginate = unserialize($this->Session-
>read("rememberpaginate"));
$this->Session->del("rememberpaginate");
}
does use the same pagination but subsequent clicks fail because
$paginator->options(array('url' => $this->passedArgs)); (in the view)
doesn't get the pagination parameters because they are not in the url
but only stored in $this->paginate.
I've been thinking about redirecting to the appropriate url (index/
page:2/partgroup_id:4 etc) after an edit/delete/add but the method for
creating this url is only in the pagination helper not in the
controller.
I know I could create a method for this but I would imagine that the
cake gurus have thought of this and I'm doing it wrong ...
Any ideas???
Wirtsi
On 7 Apr., 18:07, Kyle Decot <[EMAIL PROTECTED]> wrote:
> I am creating a skatepark directory website, and I want to include a
> filter/search box where you can search parks by name, and filter by
> state, price, size, etc. Has anybody done anything similar, or have
> any suggestions on how to do this? Thanks for the help. '
>
> My website is:http://www.theskateparkdirectory.com/browse/
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---