Basic Syntax

Smarty Manual
Prev |  | Next

# 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. They are used for making internal notes in the templates.

Example 3-1. Comments
    {* Smarty *}

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

    {include file=$includeFile}

    {include file=#includeFile#}

    {* display dropdown lists *}
    <select name="company">
    {html_options values=$vals selected=$selected output=$output}
    </select>

Prev | Home | Next
Smarty For Template Designers | Up | Functions