Deployment Guide

<!-- No user name, no table row -->
{/if}
The condition tested in the {if} {/if} block should be a valid PHP expression. 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}
<!-- included if $collection is empty -->
{/section}
The content after a {sectionelse} tag is included only if the {section} block would otherwise be empty.
Foreach Text Blocks
An easier to use alternative to the {section} {/section} tag is to use the {foreach} {/foreach} block:
{foreach key=key_var item=item_var from=$collection}
{$key_var} = {$item_var}
{foreachelse}
<!—included if $collection is empty -->
{/foreach}
The advantage of this syntax is that each item in the collection is immediately available as the named item variable,
in this example {$item_var}. This construct is also useful when iterating through associative arrays indexed by key,
as the key is immediately available with each item.
A name= attribute may be supplied with the opening {foreach} tag. When a name is supplied, the following
additional Smarty variables are available for use inside the {foreach} {/foreach} block:
l {$smarty.foreach.
name
.first} true if the item being processed is the first item in the collection
l {$smarty.foreach.
name
.last} true if the item being processed is the last item in the collection
l {$smarty.foreach.
name
.index} counter for the current item, starting at 0 for the first item
l {$smarty.foreach.
name
.iteration} counter for the current item, starting at 1 for the first item
l {$smarty.foreach.
name
.total} value indicating the total number of items in the collection
Dell Networking W-ClearPass Guest 6.1 | Deployment Guide Reference | 339