Hjälp: Template, LanguageWebGUI has a powerful templating language built to give you maximum control over the layout of your content. The following is a list of the template language syntax.
NOTE: Please note that the words foo and bar are used below as placeholders for the actual variable names that you'll use. They are not part of the template language.
Variables
Variables are the most basic of the template commands. They are used to position pieces of content.
Syntax: <tmpl_var foo> or <tmpl_var name="foo">
Example: <tmpl_var name>
Conditions
To programmers conditions are nothing new, but to designers they can often be confusing at first. Conditions are really just true or false questions, and if you think of them that way, you'll have no trouble at all.
Syntax: <tmpl_if foo> <tmpl_else> </tmpl_if>
Syntax: <tmpl_unless foo> <tmpl_else> </tmpl_unless>
Example: <tmpl_if isTrue> It was true!<tmpl_else> It was false! </tmpl_if>
Loops
Loops iterate over a list of data output for each pass in the loop. Loops are slightly more complicated to use than plain variables, but are considerably more powerful.
Syntax: <tmpl_loop foo> </tmpl_loop>
Example:
<tmpl_loop users>
Name: <tmpl_var first_name><br/>
</tmpl_loop>
Loop Conditions
Loops come with special condition variables of their own. They are __FIRST__, __ODD__, __INNER__, and __LAST__.
Examples:
<TMPL_LOOP FOO>
<TMPL_IF __FIRST__>
This only outputs on the first pass.
</TMPL_IF>
<TMPL_IF __ODD__>
This outputs every other pass, on the odd passes.
</TMPL_IF>
<TMPL_UNLESS __ODD__>
This outputs every other pass, on the even passes.
</TMPL_UNLESS>
<TMPL_IF __INNER__>
This outputs on passes that are neither first nor last.
</TMPL_IF>
<TMPL_IF __LAST__>
This only outputs on the last pass.
<TMPL_IF>
</TMPL_LOOP>
NOTE:Both the template language and template variables are case-insensitive.Se vidare: |