![]() |
Template Library - 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: Template Library (/showthread.php?tid=40174) |
Template Library - El Forum - 03-31-2011 [eluser]axiom82[/eluser] Tired of loading your header and footer above and below your controller method's primary view? This simple solution will solve your coding needs! 1. Place this code into /application/libraries/Template.php: Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); 2. Extend the base controller by placing this code into /application/libraries/MY_Controller.php: Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); 3. In your controller, place this code to build your template within a primary view: Code: class Your_Controller extends Template_Controller { That's it! Enjoy this simple template library that sits invisibly below your controller. Template Library - El Forum - 03-31-2011 [eluser]InsiteFX[/eluser] Code: $this->ci =& get_instance(); InsiteFX |