Hi all,

I know there's a lot of info around on this already but I haven't been
able to solve this issue myself.

I'm just setting up a simple search which will trawl through the
titles and bodies of news items.

I borrowed some code from the bakery here:
http://bakery.cakephp.org/articles/view/paginating-with-fulltext-searches

I made a few minor changes but it's more or less the same

in my news controller:
function admin_search() {
        $this->News->recursive = 1;
        $conditions = array();

                if (isset($this->params['url']['q'])) {

                        $input = $this->params['url']['q'];

                        App::import('Sanitize');
                        $q = Sanitize::escape($input);

                        $options['conditions'] = 
array("MATCH(News.title,News.body)
AGAINST('$q' IN BOOLEAN MODE)");

                }

                $this->set(array('results' => $this->paginate('News',
$options['conditions'])));

                }

In the bakery article they just had:
$this->set(array('results' => $this->paginate('News', $options)));
But that wouldn't work for me?

So according to the manual to pass the query string to the paginator I
just put this line of code at the top of my view:
<?php $paginator->options(array('url' => $this->passedArgs)); ?>

So it works as in it returns the first page of results (via /admin/
news/search?q=test) but when I hover over the next/back/page number/
filter links it doesn't pass on the search query string it just looks
like:
/admin/news/search/page:2

If I manually enter a query string it works perfectly i.e. /admin/news/
search/page:2?q=test

Any ideas why the querystring isn't being used by the paginator?

TIA.

-Brett.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to