• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
URI routing to give impression of directories

how can i do to give impression of directories for a controller without using routes.php.

Sorry :|

Little confused here? What do you mean?

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

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?

If your page name is only going to be in the last piece of the url, you could just make your route like this:
$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'.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.