366
| Reference
Amigopod 3.7
| Deployment Guide
Comments
To remove text entirely from the template, comment it out with the Smarty syntax
{*
commented text *}
.
Note that this is different from a HTML comment, in that the Smarty template comment will never be
included in the page sent to the Web browser.
Variable Assignment
To assign a value to a page variable, use the following syntax:
{assign var=name value=value}
The “value” can be a text value (string), number, or Smarty expression to be evaluated, as shown in the
examples below:
{assign var=question value="forty plus two"}
The question is: {$question}
{assign var=answer value=42}
The answer is: {$answer}
{assign var=question_uppercase value=$question|strtoupper}
THE QUESTION IS: {$question_uppercase}
Conditional Text Blocks
To include a block of text only if a particular condition is true, use the following syntax:
{if $username != ""}
<tr>
<td class="nwaBody">Username:</td>
<td class="nwaBody">{$username}</td>
</tr>
{else}
<!-- No user name, no table row -->
{/if}
The condition tested in the
{if} … {/if}
block should be a valid PHP expression. Note that the
{else}
tag does
not require a closing tag.
Script Blocks
The brace characters
{
and
}
are specially handled by the Smarty template engine. Using text that contains
these characters, such as CSS and JavaScript blocks, requires a Smarty block
{literal} … {/literal}
:
<script type="text/javascript" language="JavaScript">
{literal}
<!--
function my_function() {
// some Javascript code here
}
// -->
{/literal}
</script>
Failing to include the
{literal}
tag will result in a Smarty syntax error when using your template. Single
instances of a
{
or
}
character can be replaced with the Smarty syntax
{ldelim}
and
{rdelim}
respectively.
Repeated Text Blocks
To repeat a block of text for each item in a collection, use the
{section} … {/section}
tag:
{section loop=$collection name=i}
<tr>
<td class="nwaBody">
{$collection[i].name}
</td>
</tr>
{sectionelse}
Summary of Contents for Amigopod 3.7
Page 1: ...Amigopod 3 7 Deployment Guide...
Page 14: ...14 Amigopod 3 7 Deployment Guide...
Page 30: ...30 Management Overview Amigopod 3 7 Deployment Guide...
Page 108: ...108 RADIUS Services Amigopod 3 7 Deployment Guide...
Page 132: ...132 Operator Logins Amigopod 3 7 Deployment Guide...
Page 240: ...240 Guest Management Amigopod 3 7 Deployment Guide...
Page 332: ...332 Administrator Tasks Amigopod 3 7 Deployment Guide...
Page 336: ...336 Administrator Tasks Amigopod 3 7 Deployment Guide...
Page 345: ...Amigopod 3 7 Deployment Guide Hotspot Manager 345...
Page 362: ...362 High Availability Services Amigopod 3 7 Deployment Guide...