Template Syntax Last Modified: 2014-09-25

Views : 951 Print Article

The basic template syntax can be seen by looking at the templates. Template files simply use regular HTML along with tags for where the Gsmbackbase data is inserted into them. All pages have specific variables which you can use. To view a complete list of variables available on a given page, enter the following tag into the template file:


When you next access that template file after adding this code, a popup window will appear showing you all the different variables which you can use on the page. Variables can be accessed using the syntax.

Using curly braces for literal statements

If you end up using (for example) JS in your templates in-line (instead of using src="#"), you may not get the results that you'd expect. Your smarty template will fail and you will either receive a blank page or an error page (depending on your configuration). To prevent this from happening, you can execute code by using the {literal} tag.




Everything within the {literal} {/literal} tags will not be parsed (such as the template variables above). However, you would be able to accomplish adding the template variables by using multiple literal statements, such as this:


Displaying Text to Logged In Users Only

To display something on the page only if a user is logged in, use the following syntax:

{if $logedin} User is logged in so display client only information {else} User is not logged in so display this {/if}

Displaying Text if Certain Conditions Are Met

In a similar vein it can be useful to display things only if certain conditions are met. For example you might want to display card scheme logos associated with your different payment gateways, or show information based upon what is displayed on the page. This is done using if commands:

{if $gateway.name eq "PayPal"}

     We accept PayPal


Would display the message "We accept PayPal" if that option is available on the checkout page. This can be used for any variable.

More Information

For furthur documentation on template customisations, see the official Smarty documentation @ http://smarty.net/docs.php

Google+ RSS
Google Post

© Sanvi Software Ptv Ltd 2016 | Dhru™ | Smart Lifestyle™ | Dhru Cloud™

Privacy Policy | TOC

Go to TopBack to Top