Welcome Guest, Not a member yet? Register   Sign In
Several segments in the URL
#6

[eluser]BrianDHall[/eluser]
The easiest way I can think of is to use routes to remap category[1] to category_controller/category[1], then in the index() function of that controller you use the last segment of the URI to determine the post, and then either the rest of the URI is just SEO/navigational filler or you can use it for whatever you want.

If you only want certain URLs remapped then the best practice would be to use some small bit for regex, like the category would be cat-rock or cat-classical - then you could only regex on cat- to avoid remapping everything to one controller.

If you want you can then use index - or the constructor - to then call the page function of the controller based on something in the URI, but it depends how you want to build it.

Its a little hacky and it changes how CI works, but it would work.


Messages In This Thread
Several segments in the URL - by El Forum - 09-25-2009, 10:11 AM
Several segments in the URL - by El Forum - 09-25-2009, 10:20 AM
Several segments in the URL - by El Forum - 09-25-2009, 10:26 AM
Several segments in the URL - by El Forum - 09-25-2009, 10:31 AM
Several segments in the URL - by El Forum - 09-25-2009, 10:41 AM
Several segments in the URL - by El Forum - 09-25-2009, 10:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB