Got it to work finally!! These are the final routes:
Router::connect('/:company/:controller/:action', array('controller'
=> 'home', 'action' => 'index'));
Router::connect('/:company/:controller/:action/*', array('controller'
=> 'home', 'action' => 'index'));
Router::connect('/:company/:controller', array('controller' =>
'home', 'action' => 'index'));
Router::connect('/:company', array('controller' => 'home', 'action'
=> 'index'));
All I needed to do is to change the two first routes other way down.
Sweet!
Thanks for all the help and especially the great guys at #cakephp!!
Now to a next adventure.. :)
On May 19, 4:29 am, doze <[email protected]> wrote:
> I have done more tests with these and got little bit further, but
> still having issues.. Here's the current state:
>
> With these routes:
>
> Router::connect('/:company/:controller/:action/', array('controller'
> => 'home', 'action' => 'index'));
>
> Router::connect('/:company/:controller/', array('controller' =>
> 'home', 'action' => 'index'));
>
> Router::connect('/:company/', array('controller' => 'home', 'action'
> => 'index'));
>
> Following urls work:
>
> localhost/somecompany/
> localhost/somecompany/home
> localhost/somecompany/home/test <-- goes to test() method of
> home_controller.php
>
> But action parameters don't work (because they are not being cached by
> the routes):
>
> localhost/somecompany/home/test/1 --routes to--> app\controllers
> \asd_controller.php
>
> With these routes trying to also catch the parameters for action:
>
> Router::connect('/:company/:controller/:action/*', array('controller'
> => 'home', 'action' => 'index'));
>
> Router::connect('/:company/:controller/:action/', array('controller'
> => 'home', 'action' => 'index'));
>
> Router::connect('/:company/:controller/', array('controller' =>
> 'home', 'action' => 'index'));
>
> Router::connect('/:company/', array('controller' => 'home', 'action'
> => 'index'));
>
> Following urls work:
>
> localhost/asd/home
> localhost/asd/home/test
> localhost/asd/home/test/11
>
> But the url:
>
> localhost/asd/
>
> get's routed to a null controller again, e.g. app\controllers
> \controller.php
>
> I'll update my progress as I go along, but please anyone post if you
> know what's going on!
>
> Thanks.
>
> On May 19, 3:58 am, brian <[email protected]> wrote:
>
> > 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
-~----------~----~----~----~------~----~------~--~---