Welcome Guest, Not a member yet? Register   Sign In
URI routing to give impression of directories
#1

[eluser]vishok[/eluser]
how can i do to give impression of directories for a controller without using routes.php.
#2

[eluser]minerbog[/eluser]
Sorry :|

Little confused here? What do you mean?

Can you give us more details of actually what you want to do?
#3

[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?
#4

[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';
This will 'throw away' anything between 'en' and the last part of the uri.
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'.




Theme © iAndrew 2016 - Forum software by © MyBB