On Mon, May 18, 2009 at 7:40 PM, doze <[email protected]> wrote:
>
> Hello,
>
> I'm having some problems with my routing, let's go straight to
> business:
>
> When accessing this url: http://localhost/somecompany/home
>
> 1. With route setup:
>
>    Router::connect('/:company/:controller/*');
>
>    Result:
>    Works ok, get's routed to /app/controllers/home_controller.php
>
> 2. With route setup:
>
>    Router::connect('/:company/:controller/*', array(), array
> ('company' => '[A-Z][a-z][0-9]'));
>
>    Result:
>    Fails, get's routed to /app/controllers/somecompany_controller.php
>
>    Question:
>    Why it fails when I set regexp check to the company parameter?

That regexp will catch only a string constructed of a single uppercase
letter, followed by a single lowercase letter, followed by a single
digit. Try:

[A-Za-z0-9]+

This incorporates the 3 character types in a single set.The + says to
match one or more characters.

> When accessing this url: http://localhost/somecompany/
>
> 1. With route setup:
>
>    Router::connect('/:company/*', array('controller' => 'home'));
>
>    Result:
>    Works ok, get's routed to /app/controllers/home_controller.php
>
> 2. With route setup:
>
>    Router::connect('/:company/:controller/*');
>    Router::connect('/:company/*', array('controller' => 'home'));
>
>    Result:
>    Fails, get's routed to /app/controllers/controller.php
>
>    Question:
>    Why it doesn't take the second route and find to home controller?

That one I'm unsure of as I never use the ':controller' placeholder.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to