My favorites | Sign in
Project Home Downloads Issues Source
Project Information
Members
Featured
Downloads
Wiki pages
Links

Oriented Object Template Engine in PHP

OOTemplate is a template engine write in PHP5, inspired by the django template.

What is it ?

This is a template engine for PHP, it is inspired by the django template. OOTemplate's aims is to simplify the generation of html code in PHP, it has been design to be flexible. OOTemplate has a number of backwards-incompatible changes, if you need support, please report an issue.

Please report any bugs or inconsistencies you observe. Thank you.

News

  • 2009-04-18 : ootemplate 0.8.7 new strategy for nodes and tags
  • 2009-03-22 : ootemplate 0.8.6 new tag; include
  • 2009-03-21 : ootemplate 0.8.5 new filter; tolink, see tolink filter in ootemplate
  • 2009-03-18 : ootemplate 0.8.4, new release of development.
  • 2009-03-08 : first public release : ootemplate 0.8.2.

Development Version

Documentation

note: These pages are drafts, you can check root/doc/ for others informations.

depreacted

Main features

  • Variable {{ varname }} it evaluates and replaces it with the result.
  • Possibility to access an attributes of a variable or key for an object with (.) {{ var.attribute }}
  • Applied a filter to modify a variable {{ varname | lower }}
  • Tags, Loops with {% for i in data %}, conditionals expression with {% if varname %}, and more ...
  • Block inheritance, You can define a base template for all the commons areas of your site, then you create templates children inherit from the base.

Quick Install

<?php
ini_set ('include_path', 
  ini_get ('include_path').':'.dirname (__FILE__).'/ootemplate/lib:');

require 'OOTemplate.php';

$t = new OOTemplate ('<html>Hello {% if who %} {{ who | ucfirst }} {% endif %}</html>');
$t->render ();

// output:
// <html>Hello </html>

$c = $t->getContext ();
$c->who = 'world';
$t->render ();

// output:
// <html>Hello World</html>

Other projects in relation

Powered by Google Project Hosting