The default index only works if it does not have any parameters. If
you have any parameters, then you have to mention the action (i.e,
index) in the url.
On Dec 17, 7:53 am, Lloyd <[EMAIL PROTECTED]> wrote:
> Hey everyone, I've been using cake for a little bit now but something
> has got me stumped!
>
> My controller:
>
> function index($id) { }
> function somethingElse($id){ }
> function somethingElseTwo($id) { }
>
> So basically, If i want to pass the $id to the 'somethingElse' and
> 'somethingElseTwo' functions I just go to the url:
>
> domain.com/controller/somethingElse/id <-- (id would be say 2 or
> something)
>
> But if i gowww.domain.com/controller/id and try and access the
> index page through this, it passes the id to the controller and thinks
> it's an action and not the parameter as intended to be. if i
> go,www.domain.com/controller/index/id, then that works, but obviously
> that isn't ideal for me!!
>
> I have messed around with routes and even tried this - but that
> doesn't work with ajax for some reason (maybe because its kindof
> cheating) - it does work with general links though
>
> $Route->connect('/controller/somethingElse', array('controller' =>
> 'Controller', 'action' => 'somethingElse'));
> $Route->connect('/controller/somethingElseTwo', array('controller' =>
> 'Controller', 'action' => 'somethingElseTwo'));
> $Route->connect('/controller/somethingElseThree', array('controller'
> => 'Controller', 'action' => 'somethingElseThree'));
> // anything else ie - a link pointing towards controller/id
> $Route->connect('/controller/*', array('controller' => 'Controller',
> 'action' => 'index'));
>
> Is there a way to do this properly? I'm not very good with regex
> either
>
> P.s. the real reason for wanting to simplify url's as much as
> possible is really an seo thing
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---