Support

From installation to design, content creation, and development, we're here to help every step of the way

Smarty Crash Course

Develop

SetSeed uses the well established Smarty template language for its HTML templates.

When working with Smarty templates there are few things you'll want to know.

1. Variables look like this

{$variable_name}

2. Associative array values are referenced like this

{$array_name.key_name}

3. If you add any code into your template that uses the { or } characters, you'll need to wrap the code in literal tags.

{literal}*Code here*{/literal}

4. You can loop through arrays like this:

{foreach from=$array_name item=item key=key name=loop1}
{$item}
{/foreach}

5. Comments are wrapped in {* *} e.g.:

{* This is a comment, it won't be parsed by Smarty or output when displayed *}

6. Simple IF/ELSE logic looks like this:

{if $variable_name == "test value"}
{* Do something here *}
{else}
{* Do something here *}
{/if}

7. OR comparisons look like this:

{if $variable_name == "test value" || $another_variable_name == "another test value"}
{* Do something here *}
{else}
{* Do something here *}
{/if}

8. AND comparisons look like this:

{if $variable_name == "test value" && $another_variable_name == "another test value"}
{* Do something here *}
{else}
{* Do something here *}
{/if}

9. You can include other files like this:

{include file="nav/nav.tpl"}

The file include path starts at the ~/templates/ folder so you can simply start with the next folder in the Smarty include 'file' value.

10. You can assign variables for included files like this:

{include file="nav/nav.tpl" variable_name="variable_value"}

The {$variable_name} variable will then be available within the included file.

11. Access PHP functions and the SetSeed Widget API functions using this format:

{function_name parameter_1_name=value parameter_2_name=value}
 

Search

Added to basket

CheckoutContinue shopping

Get Started