Dell Powerconnect W-ClearPass Virtual Appliances W-ClearPass Guest 6.0 Deploym - Page 264
Smarty Template Syntax, Text Substitution, Template File Inclusion, Comments, Variable Assignment
View all Dell Powerconnect W-ClearPass Virtual Appliances manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 264 highlights
Smarty Template Syntax Dell Networking W-ClearPass Guest's user interface is built using the Smarty template engine. This template system separates the program logic and visual elements, enabling powerful yet flexible applications to be built. When customizing template code that is used within the user interface, you have the option of using Smarty template syntax within the template. Using the programming features built into Smarty, you can add your own logic to the template. You can also use predefined template functions and block functions to ensure a consistent user interface. Basic Template Syntax Following is a brief introduction to the usage of the Smarty template engine. For more information, please refer to the Smarty documentation at http://www.smarty.net/docs.php, or the Smarty Crash Course at http://www.smarty.net/crashcourse.php. Text Substitution Simple text substitution in the templates may be done with the syntax {$variable}, as shown below: The current page's title is: {$title} Template File Inclusion To include the contents of another file, this can be done with the following syntax: {include file="public/included_file.html"} Smarty template syntax found in these files is also processed, as if the file existed in place of the {include} tag itself. Comments To remove text entirely from the template, comment it out with the Smarty syntax {* commented text *}. Be aware that this is different from an 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 != ""} Username: {$username} {else} 264 | Smarty Template Syntax Dell Networking W-ClearPass Guest 6.0 | Deployment Guide