w3-tools.com - Free Webmaster Tools and Resources
 
w3-tools.com - Free Webmaster Tools and Resources
 Free Webmaster Tools and Resources

 



Smarty Manual

This manual is provided as a courtesy. It is not an official source. Please check smarty.php.net for updated information.

Smarty Manual

Smarty Manual

Chapter 3. Basic Syntax

All Smarty template tags are enclosed within delimiters. By default, these delimiters are { and }, but they can be changed.

For these examples, we will assume that you are using the default delimiters. In Smarty, all content outside of delimiters is displayed as static content, or unchanged. When Smarty encounters template tags, it attempts to interpret them, and displays the appropriate output in their place.

Comments

Template comments are surrounded by asterisks, and that is surrounded by the delimiter tags like so: {* this is a comment *} Smarty comments are NOT displayed in the final output of the template, unlike <!-- HTML comments --> They are useful for making internal notes in the templates.

Example 3-1. Comments

<body>
{* a single line comment *}

{* this multiline
    comment is
   not sent to browser
*}

{* include the header file here *}
{include file="header.tpl"}


{* Dev note:  $includeFile is assigned in foo.php script  *}
<!-- this html comment is sent to browser -->
{include file=$includeFile}

{include file=#includeFile#}

{* this <select> block is redundant *}
{*
<select name="company">
  {html_options options=$vals selected=$selected_id}
</select>
*}
</body>

Newsletter

Join to our newsletter and receive news and updates about our site.
Your name: 
E-mail address: 
Action: 
 

Hosted by

Search

Google
Web w3-tools.com

Links

  What is my IP? Find your IP address!     Valid XHTML 1.0 Transitional  
Copyright © 2006. by w3-tools.com. All rights reserved