Template engine


The TIP_Template_Engine class provides an abstraction of the template parser. This means the TIP system does not relies on a specific template engine but can use any valid implementation of this class.

The TIP_Template object

A single template file is run throught a TIP_Template instance that represents itsself. This file is referenced throught the TIP_Template::path property.

Technical details

Interaction between template engines and modules

The template engine interacts with the modules by calling the TIP_Module::getTag() method. This is the base of the interaction between template engines and modules.

The getTag method is defined in module.php in the following form (the debug sections are stripped from the real template):

public function getTag($name, $params)
  $name = strtolower($name);
  $method = 'tag' . $name;

  if (!method_exists($this, $method)) {
    TIP::error("the method does not exist ($method)");
    return null;

  return $this->$method($params);

As you can see, the tag is defined as a module method with the 'tag' string prefixed to its name. This means calling getTag('raw', 'test') will be resolved in the tagRaw('test') call.

Template engine was last modified by Nicola on Fri 15 May 2009 10:33:58 PM CEST
Hosted by BerliOS Developer Logo