my simple template for codeigniter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12) +--- Thread: my simple template for codeigniter (/showthread.php?tid=61696) |
my simple template for codeigniter - nasser.man - 05-06-2015 there are some tutorials and libraries about adding templates to codeigniter, after some searching i created a simple one for my own application, it just works and i want know yours opinion about it, first of all : i used wiredesignz / codeigniter-modular-extensions-hmvc, i have a Template class in : application/modules/site_core/libraries/Template.php PHP Code: <?php in this function, i get name of "view" to load into template and an array of data for pass to the "view", yes it is possible to send more than one view/data to this method but i want to load other position from other controllers (by using database), and of course, it is possible to send name of template and load different templates depend on pages and urls, but in my case i want to use "bootstrap" template, my "bootstrap" template located at application/templates folder : Code: application/templates/ index.php is the main file that contains main HTML of themplate, any html template can be converted to template , this is my "bootstrap" template : PHP Code: <?php {content} , {sidebar1} , {sidebar2} , ... will replaced by template class, for loading a template in controllers i use : PHP Code: $this->template->load('welcome_message'); this is all of my template engin ! i will be glad to know your suggestions |