Default static page controller? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Default static page controller? (/showthread.php?tid=14925) |
Default static page controller? - El Forum - 01-20-2009 [eluser]copernicus[/eluser] I have a site that contains about half dynamic and half static pages, right now I have a controller for every static page but they only set the page title, load the navigation and then a view. Is there a way I can have just one controller that handles all static pages with each function inside it loads the correct view? Is there a way to do this without writing 10-15 routing rules? Default static page controller? - El Forum - 01-21-2009 [eluser]Crimp[/eluser] Sure, just make one page controller that has methods for each static page: /page/static. The static method then simply loads the view. It all depends on your prefs. for an URL scheme. Default static page controller? - El Forum - 01-21-2009 [eluser]Phil Sturgeon[/eluser] Lifting some code from Dyllon to do this, modified of course. application/libraries/My_Router.php Code: class MY_Router extends CI_Router { |