Documentation: template language : tags
#unix-path{the-space-path}#
Calls another templates at this point, changing space to a subscpace given by path. A path can be skipped to not to subspace.
Examples:
#admin/tableheader{}# #siteparts/image_with_border{catalog_item}#
#if the-space-path#something#/if#
Inserts something (this can be text or any number of other template tags) only if data pointed by the-space-path is true. (i.e. exists, is not an empty string or 0, not an empty array).
Example:
#if price# #format(G2):price# #/if# #unless price#No price given#/unless#
#unless the-space-path#something#/if#
Works like an #if# tag but opposite.
#if Q:http-request-field-name#something#/if#
Similar to previous #if# tag, but uses an http request field value instead.
Example:
<!-- This is an example of login form. --> <!-- Should user enter his password wrong, a login field --> <!-- will still contain his login from previous attempt -->
<!-- There is a current page address in the space and is called 'action' --> <form action="#action#" method="POST"> <input type="text" name="do_login" value="1">
<!-- An url to go on successfull login --> <input type="text" name="login_ok" value="/login_ok/"> <table> <tr><td colspan="2">Public entrance</td><tr> <tr> <td>Login</td> <td><input type="text" name="login" size="20" value="#Q:I:login#"></td> </tr> <tr> <td>Password</td> <td><input type="password" name="password" size="20"></td> </tr> #if Q:login#<tr><td colspan="2">Wrong login/password</td><tr>#/if# <tr> <td colspan="2" align="right"><input type="submit" value="Enter"></td> </tr> </table> </form>
#unless Q:http-request-field-name#something#/unless#
Similar to previous #unless# tag, but uses an http request field value instead.
#foreach {path}# something #/foreach#
Iterates through an array pointed by path, adding 'something' template using data in array member instead of the space.
<table border="0"> <tr><td><b>Categories list</td></tr> #foreach {categories}# <tr><td><a href="/category_view/?id=#id#">#T:name#</td></tr> #/foreach# </table>
#foreach newname {path}# something #/foreach#
Iterates through an array pointed by path, adding 'something' template replacing 'newname' member in current space with data in array member.
Example:
<table border="0"> <tr><td><b>Categories list</td></tr> #foreach category {categories}# <tr><td><a href="#action#?mode=view&id=#category/id#">#T:category/name#</td></tr> #/foreach# </table>
#each number1:number2# something #/each#
(used in foreach cycles) Adds 'something' only when row number divided by number1 has a remainder equal to number2. Do remember that row number starts with zero.
Example (coloring each second line with gray):
<table border="0"> <tr><td><b>Categories list</td></tr> #foreach category {categories}# <tr><td #each 2:1#style=" background-color: #e0e0e0;" #/each#> <a href="#action#?mode=view&id=#category/id#">#T:category/name# </td></tr> #/foreach# </table>
#each clean#
Cleans row number counter, setting it to zero.
|