Codeigniter easy template library

Codeigniter easy template library
By ID Media | Friday 1st July 2016

Hello fox ! there are many ways to load view on codeigniter framework, simply we can load view by this->load->view(‘file_name’). But that is not enough when you develop more complex application. There are many template library some are good and some are massive while playing with it.

Here is one simple and the best template library I ever see for codeigniter framework:

class Template {

var template_data = array();

function set(name, value) {

this->template_data[name] = value;

}

function load(template = ”, view = ”, view_data = array(), return = FALSE) {

this->CI = & get_instance();

this->set(‘contents’, this->CI->load->view(view, view_data, TRUE));

return this->CI->load->view(template, this->template_data, return);

}

}