URI routing to give impression of directories |
[eluser]vishok[/eluser]
how can i do to give impression of directories for a controller without using routes.php.
[eluser]minerbog[/eluser]
Sorry :| Little confused here? What do you mean? Can you give us more details of actually what you want to do?
[eluser]vishok[/eluser]
i'm working on a cms based on codeigniter. I make a controller named 'page' and in it a function named 'index'. In my routes.php i write this $route['en/([\\w.-]*)'] = "page/index/en/$1". So every time i wrote something like this http://mysite.com/en/hotel_eden in address bar of my browser codeigniter call the controller 'page' and the function 'index'. By uri segment i take the rest to call the right view and show it. Now i would like to assign dynamically a category to my page. es. i'd like to have something like this http://mysite.com/en/hotel/hotel_eden and get the same page. Is it possible?
[eluser]mddd[/eluser]
If your page name is only going to be in the last piece of the url, you could just make your route like this: Code: $route['en/(.*)([^/]+)'] = 'page/index/en/$2'; So en/hotel_eden will go to page/index/en/hotel_eden. But en/hotels/hotel_eden will also go to page/index/en/hotel_eden. And en/a/b/c/d/hotel_eden will also go to page/index/en/hotel_eden. The downside is, of course, that the 'folder name' does not do anything. So you couldn't have a page en/hotels/list and a page en/restaurants/list because both would go to 'list'. |
Welcome Guest, Not a member yet? Register Sign In |