easy template system

Current release: 3.06a
Date: May-26-2004
Contact: franck dot marcia at gmail dot com
License: LGPL
Copyright © 2002-2006 Franck Marcia
Support ETS!

Rate ETS at HotScripts.com
Member of
prev next
random list
join the ring

Codewalkers.com - Resource for PHP and SQL Developers


ETS is a template system written with PHP that enables you to transform a set of data to any type of document.
For example, ETS can transform a list of product descriptions retrieved from a database to a HTML page. It can also construct SQL statements, ASCII data, XML documents...
ETS provides 4 functions to match a set of data with templates:
• sprintt which returns the built template as a string,
• printt which prints it out.
• sprintts and printts which use a string instead of a file name.
ETS supplies:
• array management,
• various conditional elements,
• access to any level in the data tree from any level in the template,
• data formatting,
• size reducing,
• integrated debug messages.
ETS works with 2 elements: the data tree and templates. The data tree contains every data that will be available. Templates define the way the data tree will be presented. You can compare it to a XML document transformed with a XSLT template: itís exactly the same concept.
ETS can manage recursive templates, allows a complete reshuffle of the template with exactly the same data tree, is extremely valuable when working with database because of the implicit use of templates...
... Itís a powerful tool that will help you efficiently to build documents.
See complete documentation with tutorial (PDF, 219 Ko)
Download the lastest release with tutorial and documentation at SourceForge.net


Template file
    <h1>Simple list</h1>
            <tr bgcolor="{const:color}"><td>{const:color} for {id}</td></tr>
                <tr><td>{_rank} element{if: {_rank} > 1}s{/} in list</td></tr>

PHP code
include 'ets.php';

function getrows()
  for ($i = 0; $i < 10; ++$i) {
    $data[$i]->id = $i;
  return $data;

$page->row = getrows();
printt($page, 'test.tpl');

Simple list

red for 0
blue for 1
red for 2
blue for 3
red for 4
blue for 5
red for 6
blue for 7
red for 8
blue for 9
10 elements in list