Getting Started with Template

Looking for documentation covering how to use Template? Head over to the User Guide.

Download and Install

  1. Download the Template Library
  2. The download contains three files:
    1. /libraries/Template.php
      Move to your application or system /libraries/ folder.
    2. /config/template.php
      Move to your application /config/ folder. We’ll review this file later.
    3. /views/template.php
      Move to your application /views/ folder. (Feel free to rename this file if a file with the same name already exists in your views/ folder.) We’ll also review this file later.
  3. Note: If you are sure you won't clash filenames, just extract the ZIP file to your application folder.
  4. You're now ready to start using Template. Learn how.

'Template' is a very generic library name. Why was it chosen?

Template was designed to read well when encountered throughout your application's code. While, yes, I could have come up with a unique, cutesy, silly name for Template, I feel such a move wouldn't be very beneficial for those who use it. Nor would it follow the clear naming standards used by core CodeIgniter classes (the whole "ignition/fire" metaphor pretty much only goes as far as the framework's name).

On that note, feel free to hack and rename Template to whatever best suits your application or preferences.

Is using Template better than using Views?

Not exactly. Using Template is a better way to use Views, or at least that's what it aims to be. Additionally, the use of Template does not alter the default functionality of CodeIgniter Views. You could have 8 Controller methods that use Template alongside 8 others that just use $this->load>view(). Along with a simple interface to template parsers and methods for handling JavaScript and CSS assets, Template is a great foundation for implementing a Templating Engine in your CodeIgniter application.