Welcome Guest, Not a member yet? Register   Sign In
Route Confusion
#2

[eluser]Glen Swinfield[/eluser]
You can't. You must have at least 1 uri segment that relates to a controller - then some way of telling the controller which page to display.

So if you have a Controller - 'Pages' you would need a method 'Content()' - this method looks at the url and decides which page to display:

Code:
function Content(){
   $page = $this->uri->segment(2);

   if($page == 'about'){
      $this->load->view('about');
   }

   // Or something (you could use a switch statement)
}

Then your url will be http://www.site.com/content/about

Your route would be:
Code:
$route['content:any'] = "pages/content";

The only way to achieve what you have asked for is to create a Controller for each static page and have the index() method deliver the content for each. - This is not a good idea.

Update: People seem to ask for this a lot - what's the obsession with single level urls? - they're really no clearer to the user if they use descriptive words.


Messages In This Thread
Route Confusion - by El Forum - 07-12-2007, 06:37 AM
Route Confusion - by El Forum - 07-12-2007, 07:50 AM
Route Confusion - by El Forum - 07-12-2007, 07:53 AM
Route Confusion - by El Forum - 07-12-2007, 09:53 AM
Route Confusion - by El Forum - 07-12-2007, 10:08 AM
Route Confusion - by El Forum - 07-12-2007, 10:09 AM
Route Confusion - by El Forum - 07-12-2007, 07:31 PM



Theme © iAndrew 2016 - Forum software by © MyBB