![]() |
CMS with default page from database? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: CMS with default page from database? (/showthread.php?tid=49837) |
CMS with default page from database? - El Forum - 03-05-2012 [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) Hope this makes sense. CMS with default page from database? - El Forum - 03-05-2012 [eluser]InsiteFX[/eluser] Code: // Grab the URI segment CMS with default page from database? - El Forum - 03-05-2012 [eluser]Sven Delle[/eluser] This is what I had to do: Code: $id = $this->site_model->get_default_page_id(); |