In the following thread from last week, http://groups.google.com/group/cake-php/browse_thread/thread/7b382a26af30253b/9e4b2735a11f9efe?lnk=gst&q=route&rnum=4&hl=en#9e4b2735a11f9efe
it is noted that adding /content/:lang/:controller/:action/ works. This may indeed be a bug with the router, but this workaround may help. HTH, Eric On 2/12/07, mcgordon <[EMAIL PROTECTED]> wrote: > > > I'm struggling with the Router in Cake 1.2 and I'm starting to think > that it might > be because I think that it's supposed to behave in a way in which it's > actually not. Here's what I'm doing. Maybe someone can point out > where > I'm going wrong. > > ============= > > For multilingual sites I distinguish the different language versions > by > appending the two letter language code to the beginning of the path. > I'm now trying to get the same structure to work using Cake. > > > /en/controller/action/id - takes you to the English version > /it/controller/action/id - takes you to the Italian one > > > I also have some static pages that should be rendered with the Pages > controller. I'd like their url structure to be: > > /en/about > /en contact > /it/about > /it/contact > etc. > > Following up on something that Nate wrote here: > http://groups.google.com/group/cake-php/msg/268e6000dc8665d5 > > > I figured I could write my routes like this: > > Router::connect('/:lang/:controller/:action/*', null, > array('lang'=>'en|it','controller'=>'articles|categories|tags')); > > Router::connect('/*', > array('controller'=>'pages','action'=>'display')); > > > Now if I've understood correctly how this is supposed to work, if I > get > an url where the first part is either "en" or "it" and the second part > is one of "articles", "categories" or "tags", then the Route matches > and > we're good to go. And, in fact, this works as expected. > > Then, for one of the static pages, say "/en/about", since the "about" > part does not match one of the listed choices for the :controller > parameter, I would expect the first route to fail and for Cake to then > drop through to the next route in the list, the pages "catch-all" in > the > hopes of finding a match. > > This doesn't happen though. Instead I'm getting the error: > > "Missing controller > You are seeing this error because controller Controller could not be > found." > > What's happening is that with the wildcards in the first Route > statement, > it matches any url I throw at it, and not just those which match the > regex, > which in turn is creating a lot of missing controller and missing > action errors. > > So my question is, am I right in expecting that the Route should not > match if the controller parameter is not one of the listed options > (which would imply that there is a bug in the Router?) or, by using > the > ":controller" wildcard, have I effectively forced myself to conform to > the full > /lang/controller/action/params url structure for every single url in > the > site? > > Any ideas? > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---