The RcbtNG template engine

Description

This is the default implementation of the TIP_Template_Engine abstract class. The format of an rcbt file is quite simple: it is a pure HTML file that can contains some tags: these tags are simple text enclosed by curly braces.
The curly braces must be used only to enclose tags. For performance reasons, the Rcbt implementation does not provide any way to escape curly braces!

How does it work?

The template that not is a tag and that is not inside a context (part of a text between a special built-id tag and {}) it is passed-throught and it goes directly to the output without modifications.

When a tag is found, it is parsed and divided into its component (module, name and params) and executed in place. This means the engine calls the function module->getTag(name,params) using the parsed module, name and params. See the template engine tutorial for technical details on the TIP_Module::getTag() method.

Tag sintax

An RCBT tag has the following syntax:

{[module.]name([params])}
The content of params will be recursively executed before the call: this means the parameters can contains itsself any sort of valid tags.

The square brakets identify an optional part. All the following tags are valid tags:

{Blog.run(block.html)}: a complete tag
{User.logout()}: a tag without parameters
{Html(age)}: a tag without module
{logout()}: a tag without module and parameters
{age}: this is a special case and it is equivalent to {html(age)}
{(age)}: another special case equivalent to {tryHtml(age)}
{}: this special sequence is used to close a context opened by some built-in tags

Built-in tags

Some tag is built-in, that is when the engine found one of such tag, it does not call the getTag() method but it executes a special operation. The following list shows these built-ins tags (the [module.] part of the tags is omitted for clarity):

The RcbtNG template engine was last modified by Nicola on Tue 26 May 2009 05:43:08 PM CEST
Hosted by BerliOS Developer Logo