>> Table of Contents >> Developer's Manual

Modifications of the syntax

The syntax of the used version of "Smarty template engine" differs in some aspects from that described in the reference manual. The following section describes this modified syntax.

Token delimiters

Unlike in the original version of Smarty, this version does not use the characters'{' and '}' as the opening and closing delimiters of Smarty codes, but the strings: '[%' and '%]'. For example, NOT "{$variable}", but "[%$variable%]". The reason is that the original characters are frequently used in many HTML documents, as they may contain scripts or stylesheets, which may cause problems when processing the templates. This is why the delimiters have been changed. (This is also recommended by the manual of the engine as a standard solution for any such cases.)

Unlike in the original, this version also allows the use of an abbreviated syntax for inserting simple variables. Instead of "[%$VARIABLE%]" this version allows the more comfortable syntax: "%VARIABLE%". However, this only applies to variables. This can NOT be used with any other Smarty-codes.

Naming conventions

Because Smarty codes are case-sensitive, it has been decided to write all variable names in capital letters for simplicity. While the names of functions and other codes are to be written in small letters. For the sake of clarity, is strongly recommended, to keep this convention.

Paths

In this version references to files (links, graphics, CSS, scripts, etc.) can be given as relative path information. File paths are automatically corrected when the page loads. It is therefore no longer necessary, to use absolute file paths only.

Configuration

Smarty is set to run in Safe Mode (security=true). The embedding of PHP code into templates is not permitted. In addition, the following features are disabled: include, include_php, php.

Author: Thomas Meyer, www.yanaframework.net