Thanks, Nate. That works. I'd actually gotten it to work with:

Router::connect('/ASK',
        array(
                'controller' => 'pages',
                'action' => 'display',
                'ask/index'
        )
);

... and this in my PagesController:

public function display($path = null)
{
        $args = func_get_args();
        $path = !is_null($args) ? $args : explode('/', $path);
        $count = count($path);
        
        if (!$count) $this->redirect('/');

        ...

This works, though links created with either of those routes still give me:

/pages/ask/index

I guess I can live with that. Thanks again.

On Sun, Jan 11, 2009 at 6:20 PM, Nate <nate.ab...@gmail.com> wrote:
>
> The 'pass' key only applies to parameters that actually come out of
> the URL.  Try this one:
>
> Router::connect('/ASK',
>    array(
>            'controller' => 'pages',
>            'action' => 'display',
>            'ask', 'index'
>    )
> );
>
>
> On Jan 10, 6:32 pm, brian <bally.z...@gmail.com> wrote:
>> A section of my site is split into several smaller sections, each of
>> those concerned with its own model:
>>
>> /ASK/funders
>> /ASK/organisations
>> ... etc.
>>
>> The routes for these are all perfect, save for the "index" route,
>> which is handled by PagesController. The view for that is in:
>>
>> /views./pages/ask/index
>>
>> ... and Pages Controller has:
>>
>> public function display() {
>>         if (!func_num_args()) {
>>                 $this->redirect('/');
>>         }
>>         $path = func_get_args();
>>
>>         // splits $path by '/' and redirects
>>         ...
>>
>> This works fine, even for deeply buried views. This is how this
>> particular view was set up in routes.php:
>>
>> Router::connect('/ASK',
>>         array(
>>                 'controller' => 'pages',
>>                 'action' => 'display',
>>                 'ask/index'
>>         )
>> );
>>
>> That route was working fine until I just changed the breadcrumb links
>> in all of the ASK views to use the proper routing arrays (because
>> routing rocks my socks)
>>
>> array('controller' => 'pages', 'action' => 'display', 'ask/index')
>>
>> However, this creates URLs like "/pages/ask/index", instead of "/ASK".
>>
>> I tried adding a 'path' param in both the view and routes:
>>
>> array('controller' => 'pages', 'action' => 'display', 'path' => 'ask/index')
>>
>> Router::connect('/ASK',
>>         array(
>>                 'controller' => 'pages',
>>                 'action' => 'display',
>>                 'path' => 'ask/index'
>>         ),
>>         array('pass' => 'path')
>> );
>>
>> This creates the URL I want, but PagesController doesn't see the arg :-(
>>
>> I can modify PagesController to check both func_get_args() and a $path
>> param. However, I'm at a loss as to what route to use, both in
>> routes.php and to pass to HtmlHelper.
> >
>

--~--~---------~--~----~------------~-------~--~----~
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