Simple template library with some core functionalities to simplify development process for CodeIgniter 2.x
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
application
LICENSE
README.md
composer.json

README.md

CodeIgniter 2+ Simple Template Library

Simple template library with some core functionalities to simplify the development process for CodeIgniter 2.x.

How to use

  1. Extract all files to your project root directory. Make sure to overwrite all files if prompted.
  2. Open app/config/autoload.php, add 'template' to $autoload['libraries'] and $autoload['config'].
  3. Edit your template configuration file application/config/template.php.
  4. Navigate to yourwebsite.dev/index.php/welcome.

Template library handles most of the views logic on its own.

With simple $this->template->load(); call inside the controller's method, it will automatically create pagetitle, pagename, scripts, stylesheets variables and subload a corresponding subview file controller/method.php if nothing was provided in load() function.

Documentation

Load custom view file:
$this->template->load('path/to/view.php');

Load custom view file within a custom template file:
$this->template->load('template/login', 'user/login/form');

Set custom page title:
$this->template->title('Product page');

Set custom breadcrumbs:
$this->template->crumb('E-commerce', 'ecommerce/index');
$this->template->crumb('Products', 'ecommerce/products');
$this->template->crumb('Product #391');

Add custom JavaScript file loading:
$this->template->script('plugin/head.js', TRUE)
$this->template->script('footer.js');

Add custom CSS file loading:
$this->template->css('print.css', 'print');

Set custom variables:
$this->template->set_item('articles', $articles); // Now you are able to use $articles inside all subviews