Documentation: template language: data output

To output contents of the space, you just use a tag containing a path inside the space (no whitespaces allowed). Path can be prefixed by one or more data modifing functions.

Data output examples are:

#name#
#Q:category_id#
#T:pageinfo/title#
#Q:I:username#
#preview(3):item/image#

 You can use following modifiers:

 

Function Meaning
T

Makes a 'text', i.e. replacing each  <,>,& with &lt;,&gt;,&amp; respectively

Example: Page #T:pageinfo/title#

B

Same as T,but also replaces each with <br>

Example: About myself:<br>#user/info#

I

Same as T, but also replaces " so output could be used as a tag attribute

Example: <input type="hidden" name="a" value="#I:a#">

preview(X)

Transforms image url to an url of a resized one. For parameters see automatic image resizing page.

Example: <img src="preview(3X):item/image">

C(X)

Crops a text if it's length is more than given. Removes any tags inside unless this is a <br> tag.

Example: <td></td>

CHK

If data pointed by path is not false (i.e. exist, not empty string, not a zero number, not an empty array), then outputs ' checked="yes"', else nothing.

Example: <input type="checkbox" name="enabled" value="1" #CHK:item/enabled#>

O

Transforms an array of hashes pointed by path to a list of options (for <select> tag), using id, name and (optionaly) level.

Example: <select name="vendor_id">#O:vendors#</select>

noslashes

Removes slashes (/) from data.

Example: <a href="/#noslashes:action#2/">Second part</a>

format(X)

Formats a number. Parameter sets a number of digits after decimal point and (optionally) requests a group sepparation (each group of 3 digits are separeated by space).

Example: Total income is: $#format(G2):income#.  This will output something like Total income is $12 345.67

 Q

This is an only function to have QUITE different meaning. It should be called first and directs engine not to take data from the space, but to take it from http requst field instead.

Example: <input type="text" name="login" value="#Q:I:login#">





©2008 Olenin Vladimir. www.dihost.ru