danieltorscho/ci_template_lib

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (dev-master) of this package.

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

dev-master 2017-05-15 09:54 UTC

This package is not auto-updated.

Last update: 2023-01-16 23:28:48 UTC


README

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