Template documentation

{var_name}

Variable

Place a variable in HTML template {var_name}. To see all available variables, use {template_infos}

Exemple
<h1>{title}</h1>
<p>{txt}</p>
Result
<h1>Contact page</h1>
<p>Contact us!<br/>Tel: 1-888-123-4567</p>

{if:var}{/if}

if

Check if a variable is empty before display. To see all available variables, use {template_infos}

Exemple
{if:tel}<p>Tel: {tel}</p>{/if}
Result
<p>Tel: 1-888-123-4567</p>

{if:var}{then}{/if}

if / then

Check if a variable is empty before display and display otherwise content. To see all available variables, use {template_infos}

Exemple
{if:search_result}
<p>
<h1>Results found</h1>
{search_result}
</p>
{then}
<p>No results</p>
{/if}
Result
<p>
<h1>Results found</h1>
1- Contact page<br/>
2- Contact form
</p>
Then result
<p>No results</p>

{list}{/list}

List

Iterate in a list values (array), dataset objects. To see all available variables, use {template_infos}

Exemple
{list:people}
<p>
<h2>{name}</h2>
<br/>{address}
{if:tel}<br/>Telephone: {tel}{/if}
</p>
{/list}
Result
<p>
<h2>John Smith</h2>
<br/>11 Hollywood Street
<br/>Telephone: 1-551-123-4567
</p>

<p>
<h2>Jane Smith</h2>
<br/>13 Hollywood Street
</p>

{call:func_name:param1:param2[:param3,...]}

Function call

Call a custom function or class method and display what it returns.

Exemple
{call:hello_world:Goodbye}
Result
Goodbye		<!-- where the function "hello_world($params[])" returns the first passed param -->

{WS_URL}

Current URL

Contains a string that represents the current base url, including the protocol and the trailing slash "/", but not the file nor the query string. Tip, use {WS_URL}{WS_REQUEST} to get the complete request string.".

Exemple
{WS_URL}
Result
http://webstudiodev.com/

{WS_REQUEST}

Current file request

Contains a string that represents the current request, including the query string, but not the domain. Tip, use {WS_URL}{WS_REQUEST} to get the complete request string.

Exemple
{WS_REQUEST}
Result
index.php?id=1

{template_infos}

Get all available values

Display all available variables, arrays and datasets

Exemple
{template_infos}

{lang: |en| text }

Different languages

Display different text / html for different languages

Exemple
{lang: |fr| <h1>Bonjour!</h1> |en| <h1>Hello!</h1> }
Result
<h1>Hello!</h1> <!-- When language is "en" (english) -->

{lang}

Current language

Variable that contains the current language code

Exemple
<a href="/{lang}/index.html">
{lang: |fr| Accueil |en| Home }
</a>
Result
<a href="/fr/index.html">Accueil</a>	<!-- Where lang is set to "fr" -->

{en} / {fr}

Current language code

Variable that has the name of the current language.

Exemple
{if:en}This is english{/if}
Result
This is english		<!-- Where lang is set to "en" -->

{rand:number}

Random number

Random number

Exemple
<img src="/images/banner_{rand:5}.jpg" />
Result
<img src="/images/banner_4.jpg" />	<!-- Where 4 can be 1 to 5 -->

{01}

Odd / Even

Make a row appear different than the other

Exemple
<td class="background_{01}">White Background</td>
<td class="background_{01}">Grey background</td>
<td class="background_{01}">White Background</td>
<td class="background_{01}">Grey background</td>
Result
<td class="background_0">White Background</td>
<td class="background_1">Grey background</td>
<td class="background_0">White Background</td>
<td class="background_1">Grey background</td>

{cms:page_id}

Display CMS content

Display CMS content from content module using page ID.

Exemple
{cms:1}
Result
<h1>Page title</h1>
<p>Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit</p>

{banner:format}

Display Banner

Display Banner selected from the existing format.

Exemple
{banner:A}