Welcome Guest, Not a member yet? Register   Sign In
Custom URL routing and interpretation?
#1

[eluser]Unknown[/eluser]
Hello,

I'm new to CI, and was wondering about custom URL routing and interpretation. Supposing I have an Online Directory with URL's constructed such as,

Code:
http://website.com/Canada/Montreal/Cars/Honda/Dealer

How would I get CI to interpret this appropriately as being individual parameters that I wish to capture and use? as the above URL does not conform to the "controller - method" system of routing that CI uses.

Any help in this regard will be appreciated..

Thanks
#2

[eluser]TheFuzzy0ne[/eluser]
Assuming you're only going to have a single controller, just rerouting all calls to that controller should work.
Code:
$route[':any'] = 'controller/method''

I'd imagine that should do it, but I haven't tested it.

You should then be able to use $this->uri->segment(n) to get your segments. Segment number 1 should be the country name. Again, I can't confirm this, as I don't use routes, but if I understand them correctly, that should work.




Theme © iAndrew 2016 - Forum software by © MyBB