Welcome Guest, Not a member yet? Register   Sign In
Routing problems
#5

[eluser]roj[/eluser]
I think the first one was right. The setup is reasonable simple:
Code:
$route['(.*)'] = "pages/index/$1";
Will pass all requests to the page controller and specifically the index function.

By doing this you set up a simple way to create individual pages. The trouble is that say you want to add a news section to the site. In order to do that you probably want to send those requests to it's own controller. ie set up an exception to the above route.

The proceeding bit is to handle any exceptions so with the $pages array you add sections that you don't want to send to the pages controller. So the array would read:
Code:
$pages = array('news');

The foreach loop then takes each item in the array and writes a route sending it where you would normally find it (as Colin pointed out) eg the news controller.

Say you also wanted to add an admin section and authors section then you just add admin & author to the $pages array:
Code:
$pages = array('news','admin','author');

...and obvious create the corresponding controllers as normal.

Hope that adds a little clarity.


Messages In This Thread
Routing problems - by El Forum - 10-19-2008, 01:59 PM
Routing problems - by El Forum - 10-20-2008, 05:53 PM
Routing problems - by El Forum - 10-22-2008, 04:53 AM
Routing problems - by El Forum - 10-22-2008, 07:15 AM
Routing problems - by El Forum - 10-22-2008, 10:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB