Welcome Guest, Not a member yet? Register   Sign In
Another URI Routing Question
#1

[eluser]ex0r[/eluser]
I'm having a bit of a problem here. Any help is highly appreciated. I am trying to achieve something as follows:

www.example.com/usa/en/directory/someClass/someFunction

Coming from Zend, i could set this using something like :country/:language/:module/:controller/:action/* where in this example the vars country=usa and language=en

Thanks
#2

[eluser]Tom Schlick[/eluser]
why not set that as a cookie / session variable rather than route your whole application?
#3

[eluser]ex0r[/eluser]
Well.. I have thought about that, but the problem with using cookie/session variables is that it wont be search engine friendly.
#4

[eluser]doob[/eluser]
Maybe somthing like this (with some changes in the regexp) in : application/config/routes.php

Code:
$route['([a-z]){0,3}/([a-z]){0,2}/(.*)/(.*)'] = "$3/$4/$1/$2";

And use
Code:
$this->uri->segment(n)
in your controller.
#5

[eluser]ex0r[/eluser]
Well.. Apparently its much easier than I thought (thanks to VSutra). I think this needs to be better documented. If anyone is interested, the correct code in its simplest form is:
Code:
$route['[a-z]+/[a-z]+/(:any)']    = "$1";

Thanks




Theme © iAndrew 2016 - Forum software by © MyBB