Welcome Guest, Not a member yet? Register   Sign In
Building a parent-child page relationship that works on the entire tree
#1

[eluser]gh0st[/eluser]
We are building a 5-page website, there are lots of parent-child page relationships.

For example:

Quote:Home
About us
-> What we do
-> Our History
----> Year 1
----> Year 2

I can create controllers for each of these pages, but I don't want to do this as this is no better than just simply making pages using Dreamweaver and then linking them up.

I want to make a controller that utilizes a parent-child relationship that works on an entire trees.

Rather than creating controllers for each of these pages; I want to use "slugs" (ie: /about-us/some-child/).

I've been able to do a pages controller with a slug as a parameter, but the problem with this is that it only works for 1 level.

ie:

Code:
class Pages extends Controller
...
function index($slug="")
{
switch ($slug)
{
  case 'about-us':
     $this->load->view("pages/about-us");
  break;

  ...etc...

} // end switch
} // end function

The problem is that the pages controller will not work on more than one level.

My question is therefore.

Let's assume you are making a 5 page website, you want to use 1 controller to handle all the parent/child relationships (it must work on the entire tree).

What is the best way to resolve this issue?




Theme © iAndrew 2016 - Forum software by © MyBB