[eluser]Sven Delle[/eluser]
Hi,
I'm trying to build a CMS with codeigniter. And I'd like to be able to set a default page for the front end in the database (via an interface - not the subject here).
I can easily query the db for the info and have the controller add the corresponding $data['page_content'] to the view. But this breaks the url, so that the menu item won't 'hilite' correctly (as the browser is not aware of the url of the default page).
How do I write a controller, that routes to the default page (typically based on a simple id number).
Something like:
Code:
public function index($page_id = NULL)
{
if(isset($page_id) && $page_id != 0)
{
// get the default page from db through model
// route to the default page
// so the correct menu items can hilite properly (self aware system)
}
else
{
// route to the requested page
}
// TODO
}
Hope this makes sense.