On Mar 21, 8:59 pm, cricket <[email protected]> wrote:
> On Mon, Mar 21, 2011 at 7:14 AM, AD7six <[email protected]> wrote:
>
> > On Mar 20, 9:44 pm, cricket <[email protected]> wrote:
> >> Using 1.3.7
>
> >> Some of my routes are apparently being ignored.
>
> > Routes don't get ignored, they simply don't match and are skipped.
>
> I found Router's interpretation:
>
> CakeRoute Object
> (
>         [keys] => Array
>                 (
>                         [0] => slug
>                 )
>
>         [options] => Array
>                 (
>                         [slug] => bio
>                         [pass] => Array
>                                 (
>                                         [0] => slug
>                                 )
>
>                 )
>
>         [defaults] => Array
>                 (
>                         [admin] => 0
>                         [controller] => pages
>                         [action] => display
>                         [prefix] => admin
>                         [plugin] =>
>                 )
>
>         [template] => /:slug
>         [_greedy] =>
>         [_compiledRoute] => #^(?:/(bio))[/]*$#
>         [__headerMap] => Array
>                 (
>                         [type] => content_type
>                         [method] => request_method
>                         [server] => server_name
>                 )
>
> )
>
> The problem seems to be the prefix. So I changed it to:
>
> Router::connect(
>         '/:slug',
>         array(
>                 'admin' => 0,
>                 'prefix' => null,
>                 'controller' => 'pages',
>                 'action' => 'display'
>         ),
>         array(
>                 'slug' => 'bio',  // not a regexp issue
>                 'pass' => array('slug')
>         )
> );
>
> echo $this->Html->link(
>         'foo',
>         array(
>                 'admin' => 0,
>                 'prefix' => null,
>                 'controller' => 'pages',
>                 'action' => 'display',
>                 'slug' => 'bio'
>         )
> );
>
> This still isn't matching.

You're mixing things up, where you are in your app is contextually
relevant - the prefix (and the admin key) if you don't change it
persists from whatever the value is for the current request. You're
apparently testing from an /admin/ url. You need to set admin and
prefix to false for the route to match - try (reading) the router test
case if you're still fuzzy.

However, again: why use routes at all for absolutely static routes.
You want the url /foo you can type /foo, but instead are typing
 array('plugin' => false, 'prefix' => false, 'admin' => false,
'controller' => 'pages', 'action' => 'display', 'slug' => 'foo')

AD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to