Hi All,

I've got a custom route which points to a sub-controller:
Router::connect('/happyvalley/news/:action/*', array('controller' =>
'happyvalley_news', 'prefix' => 'happyvalley', 'happyvalley' =>
true));

It all works fairly well except for when I add a custom parameter, in
this case 'q' (which is a search query) it completely breaks
pagination and the next/previous links show something like: /
happyvalley_news/happyvalley_index/page:2/q:test/happyvalley:1

So I did my research and found I should put something like this in my
view:
$paginator->options(array('url' => array_merge($this->passedArgs, array
('happyvalley' => true))));

Again It all works perfectly until my custom param gets in there.

Anybody have any ideas?

TIA

-Brett

PS... thought I better include the two controller functions:

function happyvalley_index() {
                $options['conditions'] = array('News.publish' => 1,
'NewsVenue.venue_id' => 1);

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

                        $input = $this->passedArgs['q'];

                        $q = $input;

                        $options['conditions'] = array(
                           "MATCH(News.title,News.body) AGAINST('$q' IN BOOLEAN 
MODE)",
array('News.publish' => 1, 'NewsVenue.venue_id' => 1));
                }
                $this->News->recursive = 2;
                $this->News->NewsVenue->bindModel(array('belongsTo' => 
array('News',
'Venue')), false);
                $this->set(array('news' => $this->paginate('NewsVenue', $options
['conditions'])));
                $this->layout = 'default_happyvalley';
                $this->viewPath = 'news/happyvalley';
        }

        function happyvalley_results() {
                if (($this->params['url']['q']) <> NULL) {
                        $input = $this->params['url']['q'];
                        $q = $input;
                        $this->redirect(array('happyvalley' => TRUE,
'action'=>'happyvalley_index'.'/q:'.$q), null, true);
                }
                $this->redirect(array('happyvalley' => TRUE,
'action'=>'happyvalley_index'), null, true);
                $this->layout = 'default_happyvalley';
                $this->viewPath = 'news/happyvalley';
        }

The form in the view just posts to "happyvalley_results" which is then
redirected to the index.
--~--~---------~--~----~------------~-------~--~----~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to