Welcome Guest, Not a member yet? Register   Sign In
How to bypass first segment in routing?
#1

[eluser]Ki[/eluser]
I am trying to set up routing that will accommodate language in uri
there are 2 possibilities:
www.site.com/en/controller/method
www.site.com/controller/method

I have defined my languages in the array just before the routing definition:
$langs = array('en'=>'english','fr'=>'french')

Then, I do this
foreach($langs as $key=>$value){
$route["^$key/(.+)"] = "$1";
}
The above works for
www.site.com/en/products/ but not for www.site.com/en/products/page/1/

The above rule of bypassing any language definition in the uri should apply thought the site, but then some controllers need to accept (:any). Like the example above, anything like /products/blah/blah/blah/ needs to be passed to the products controller index method
the same with /en/products/blah/blah/blah/ - this too needs to go to products controller index method.

Any examples on how to accomplish this? Note that /en/help/contact_us needs to go to help controller, contact_us method - not all routes use (:any)


Messages In This Thread
How to bypass first segment in routing? - by El Forum - 08-05-2010, 04:17 AM
How to bypass first segment in routing? - by El Forum - 08-05-2010, 04:41 AM
How to bypass first segment in routing? - by El Forum - 08-15-2010, 04:28 AM
How to bypass first segment in routing? - by El Forum - 08-15-2010, 07:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB