Smart Tags

Smart Tags | Page Variables | Session Variables | Snippets | PHP | Language Variables (Constants) | SQLITE | GET variables | Templates Markup

 Smart Tags Description OutputResult
User's browser version number 2.0
User's browser CCBot
Display user's two-letter country code. See Country Codes. US
Display user's country ID. See Country Codes. 2
Display user's country name. See Country Codes. United States
Customers first name
Current date 20/04/2018
Current day Friday
Current month April
Current time 4:59pm
Current week 16
Current year 2018
Display a selector for switching currency - shows all currencies.
Display a selector for switching currency - shows all currencies with full name and unit.
Display a selector for switching currency - shows only main currencies.
Form for logging in
<script type="text/javascript" src="/js/login.js"></script>
<form name="login" action="/login/" method="post" class="form-standard" onSubmit="return secure_password(this)">
<input type="hidden" name="seed" value="">
<input type="hidden" name="md5_password" value=""><input type="hidden" name="local" value="">
<fieldset>
<legend>Login</legend>
<input type="hidden" name="action" value="" class="hidden" />
<div class="row required" id="row-email">
 <label for="email">Email address</label>
 <input name="vendorama_email" type="text" id="email" size="20" value="" maxlength="100" class="text" />
</div>
<div class="row required" id="row-password">
 <label for="vendorama_password">Password</label>
 <input type="password" name="vendorama_password" id="vendorama_password" size="20" maxlength="50" class="password" /> <span class="highlight-note"><a href="/login/password/" name="fpass" title="Retrieve your password" rel="Password nofollow">Forget your password?</a></span>
</div>
<div class="row-optional">
 <span class="margin">&nbsp;</span><input type="checkbox" value="4" name="auto_login" id="auto_login" /><label for="auto_login" class="none">Remember me</label>
</div>
</fieldset>

<div class="box-action">
 <span class="margin">&nbsp;</span>
 <input type="submit" name="login" value="Log in" class="submit button-login" accesskey="l" title="Log in (Alt Shift l)" id="submit-login" />
</div>
</form>
Login
 
 
Subscribes user to Mailouts, (with double optin-in confirmation required)
<script type="text/javascript">
 <!--

 function validateFormSubscribe() {
  var submitFormSubscribe = true;
  var errors = "To subscribe please enter your name and email address.";


  if (document.form_mailouts_subscribe.first_name.value == "") {
   errors += "";
   submitFormSubscribe = false;
   }
 
 
 
   if (document.form_mailouts_subscribe.useremail.value != "") {
    if ((document.form_mailouts_subscribe.useremail.value.indexOf("@") == -1) ||
 (document.form_mailouts_subscribe.useremail.value.indexOf(".") == -1)) {
     errors += " That doesn't look like a real email address.";
     submitFormSubscribe = false;
    }
   } else {
    errors += "";
    submitFormSubscribe = false;
   }
 
   if (document.form_mailouts_subscribe.email.value !== "") {
   errors += " The authentication field should be left blank";
   submitFormSubscribe = false;
   }
 
 
 
   if (!submitFormSubscribe) {
    errors += "";
    alert(errors);
   }
 
   return submitFormSubscribe;
 
  }
 
  // -->
  </script>
<form name="form_mailouts_subscribe" id="form_mailouts_subscribe" method="post" action="/email/optin.php" onsubmit="return validateFormSubscribe();" class="form-standard">

<fieldset>
<legend>Subscribe</legend>

<div class="row-optional" id="row_firstname">
 <label for="firstname">First Name</label>
 <input type="text" name="first_name" id="first_name" class="text" value="" />
</div>

<div class="row-required" id="row_useremail">
 <label for="useremail">Email</label>
 <input type="text" name="useremail" id="useremail" class="text" value="" />
</div>

<div class="row-required row-email" style="display:none" id="row_authentication">
 <label for="email">Authentication (leave this blank)</label>
 <input type="text" name="email" id="email" class="text" value="" />
</div>

</fieldset>

<div class="box-action">
 <span class="margin">&nbsp;</span>
 <input type="submit" name="subscribe" value="Subscribe" class="submit button-subscribe" accesskey="1" title="Subscribe (Alt Shift 1)" id="submit-subscribe" />
</div>

</form>
Subscribe
 
Generic subscription form that sends an email to the email address in /vendo/profile/

Posts to /contact/subscribe/

Note: this does not add to the Mailouts database, use {$FORM_MAILOUTS} instead
<script type="text/javascript">
 <!--

 function validateFormSubscribe() {
  var submitFormSubscribe = true;
  var errors = "To subscribe please enter your name and email address.";


  if (document.form_subscribe.firstname.value == "") {
   errors += "";
   submitFormSubscribe = false;
   }
 
 
 
   if (document.form_subscribe.user_email.value != "") {
    if ((document.form_subscribe.user_email.value.indexOf("@") == -1) ||
 (document.form_subscribe.user_email.value.indexOf(".") == -1)) {
     errors += " That doesn't look like a real email address.";
     submitFormSubscribe = false;
    }
   } else {
    errors += "";
    submitFormSubscribe = false;
   }
 
   if (document.form_subscribe.email.value !== "") {
   errors += " The authentication field should be left blank";
   submitFormSubscribe = false;
   }
 
 
 
   if (!submitFormSubscribe) {
    errors += "";
    alert(errors);
   }
 
   return submitFormSubscribe;
 
  }
 
  // -->
  </script>
<form name="form_subscribe" id="form_subscribe" method="post" action="/contact/subscribe/" onsubmit="return validateFormSubscribe();" class="form-standard">

<fieldset>
<legend>Subscribe</legend>

<div class="row-optional" id="row_firstname">
 <label for="firstname">First name</label>
 <input type="text" name="firstname" id="firstname" class="text" value="" />
</div>

<div class="row-required" id="row_user_email">
 <label for="user_email">Email</label>
 <input type="text" name="user_email" id="user_email" class="text" value="" />
</div>

<div class="row-required row-email" style="display:none" id="row_authentication">
 <label for="email">Authentication (leave this blank)</label>
 <input type="text" name="email" id="email" class="text" value="" />
</div>

</fieldset>

<div class="box-action">
 <span class="margin">&nbsp;</span>
 <input type="submit" value="Subscribe" name="submit" id="button-subscribe" />
</div>

</form>
Subscribe
 
The last search by user
Search form
<form action="/search/" method="post" name="form_search" id="form_search" class="form-search"> <fieldset>
   <div class="search-vq">
   <label for="vq" id="label_vq">Shop for</label>
   <input type="search" name="vq" id="vq" onkeyup="search_suggest();showstuff('search_suggest_list'); hidestuff('search_suggest_vu_list');" onfocus=" this.placeholder = '';" onblur=" if(this.value.length<2) { this.placeholder = 'Shop for...';} "  autocomplete="off" value="" maxlength="275" placeholder="Shop for..." /><div id="search_suggest" style="display:inline" onmouseover="showstuff('search_suggest_list');"></div><input type="image" name="search" value="Search" class="submit button-search" src="/img/icon/search.png" id="image-search1" /> 
   <img src="/img/icons/filter-original.png" id="icon_filter" alt="filter" onclick="
   open_close('search_filters'); 
   toggle_value('filters','1','0'); 
   session_var('vendo_search','filters'); 
   hidestuff('search_suggest_list'); 
    if(document.getElementById('filters').value==0) { setfocus('vq');} 
   filter_state();
   return false;" />
   </div>
   
 <div class="closed" id="search_filters">
  <div for="vu" class="none filter filters-store"> 
  <label for="vu">Store: </label><input type="text" value="" size="20" name="vu" id="vu" placeholder="all stores" onkeyup=" search_suggest_vu(); showstuff('search_suggest_vu_list'); hidestuff('search_suggest_list'); " onfocus=" this.placeholder = '';" onblur=" if(this.value.length<2) { this.placeholder = 'all stores'; } "  autocomplete="off" /><div id="search_suggest_vu" style="display:inline"></div></div>
   <div class="filter filters-price"><label for="price_all" class="none">Price: $<input type="text" size="3" name="price_from" id="price_from" value="" class="numeric size3" step="1" /> to $<input type="text" size="3" name="price_to" id="price_to" value="" class="numeric size3" step="1" /> </label> </div>
  <div class="filters-checkboxes">
  

  <div class="filter links-layout-onsale hotspot" >
  <input type="checkbox" name="onsale" id="onsale" value="1" onchange="hidestuff('sale_remove'); class_name('label_onsale','label-onsale'); setfocus('vq');"/><label for="onsale" id="label_onsale" class="label-onsale">On sale</label>
 </div>

  </div>
  </div>
  
 </fieldset><input type="hidden" value="0" name="filters" id="filters" />
</form>

 <div id="create_links"> <a href="/account/new/" class="link-account" title="Create account"><img src="/img/icon/account.png" alt="account" /></a>
 	
   <a href="/login/" onclick="document.getElementById('header_create_links').className = 'div_visible';  hidestuff('create_form');showstuff('create_form2');setfocus('email');return false;" class="toggle">Log in</a>
   | 
  <a href="#" onclick="document.getElementById('header_create_links').className = 'div_visible'; hidestuff('create_form2');showstuff('create_form');setfocus('vendor_name');" class="toggle">Sell</a>  
 </div>
<div class="div_hidden" id="header_create_links">
 <div id="create_form">


  <form method="post" action="/" name="form_create_store" id="form_create_store" class="form-standard">
 <span onclick="hidestuff('create_form'); showstuff('create_links'); setfocus('vq');" class="vendo-close">&times;</span>
  <fieldset>
  <legend>Create a store</legend>
   <input type="hidden" name="product_id" value="5" />
   <input type="hidden" name="create_store" value="1" />
   <input type="text" size="30" maxlength="99" value="" name="vendor_name" id="vendor_name" placeholder="Store name" class="text" onkeydown="
   if(this.value!='' && this.style.borderColor!='red') { this.style.borderColor='#AAA'; } 
   if(this.value!='' && this.style.borderColor=='red') { this.style.borderColor='green'; } 
   " />
   <input type="submit" name="submit_storename" value="Create a Store" class="button-create" onclick="if(document.getElementById('vendor_name').value=='') { document.getElementById('vendor_name').style.borderColor='red'; return false; } else { document.getElementById('form_create_store').style.opacity=0.3; document.getElementById('loading2').style.display='block'; } " /> 
  </fieldset>
  <span style="display:none" id="loading2" class="submitted"></span>

  <div class="hint">Create a new online store using Vendo&rsquo;s store builder 
	<script>
	function showNext(id) {
		var x = document.getElementById(id).nextElementSibling.style.display;
		// hide all
		var elements = document.getElementsByClassName('box-info');
		for(var i=0; i<elements.length; i++) { 
  			elements[i].style.display='none';
		}
		if(x=='block') {
			document.getElementById(id).nextElementSibling.style.display='none';
		} else {
			document.getElementById(id).nextElementSibling.style.display='block';
		}
	}
	</script>
<div class="helpdiv highlight-help-admin" id="helpdiv0" onclick=" showNext(this.id); ">+</div>
  <div class="box-info" onclick="this.style.display = 'none';"><span class="help-pointer"></span>
    You can set up a new customisable online store with Vendo and start selling today. <br /><br />
    When you create a Vendo store your products are updated on Vendo search results instantly.
    <br /><br />See <a href="/features/">features</a> and <a href="/pricing/">pricing</a> for more info.
  </div>
  </div>
  
  </form> 
  
  
  <p class="create-or" id="create_or"><span>OR</span></p>


 
 <form method="post" action="/" name="form_add_url" id="form_add_url" class="form-standard">
 <fieldset>
  <legend>List on Vendo</legend>
   <input type="hidden" value="external" name="mode" />
   <input type="text" size="30" maxlength="99" value="" name="vendor_name_url" id="vendor_name_url" placeholder="http://" onfocus="this.value = this.value;" class="text" onkeydown="
   if(this.value!='' && this.value!='http://' && this.style.borderColor!='red') { this.style.borderColor='#AAA'; } 
   if(this.value!='' && this.value!='http://' && this.style.borderColor=='red') { this.style.borderColor='green'; } "  />
   <input type="submit" name="submit_storeurl" id="submit_storeurl" value="Submit URL" class="button-create" onclick="if(document.getElementById('vendor_name_url').value=='' || document.getElementById('vendor_name_url').value=='http://') { document.getElementById('vendor_name_url').style.borderColor='red'; return false;} else { document.getElementById('form_add_url').style.opacity=0.3; document.getElementById('loading1').style.display='block'; }
   " /> 
  </fieldset>
  <span style="display:none" id="loading1" class="submitted"></span>
  
  
  <div class="hint">Enter your website address if you have an online store <div class="helpdiv highlight-help-admin" id="helpdiv1" onclick=" showNext(this.id); ">+</div>
  <div class="box-info" onclick="this.style.display = 'none';"><span class="help-pointer"></span>
    Vendo will import your products from your website automatically, and list on Vendo&rsquo;s search results (when your products match a customer&rsquo;s search).<br /><br />See <a href="/bot/">Vendobot</a> for more information about Vendo search indexing or <a href="/pricing/">pricing</a> if you would like to list more than 50 products.
  </div>
  </div>
  </form>
  
  
  
  <br />
  
  <p class="hint">Vendo is free for the first 50 products, or  <a href="/pricing/">from $49 per month...</a></p>

  
  
 </div>
 <div id="create_form2">
  <script type="text/javascript" src="/js/login.js"></script>
  <form name="login" action="/login/" method="post" class="form-standard" onSubmit="return secure_password(this)">
  <span onclick="hidestuff('create_form2');showstuff('create_links');setfocus('vq');" class="vendo-close">&times;</span>
  <fieldset>
  <legend>Log in to Vendo</legend>
  <input type="hidden" name="seed" value="">
  <input type="hidden" name="md5_password" value="">
  <input type="hidden" name="return" value="/code-library/?t=1" />
  <input type="hidden" name="local" value="">
  <input type="hidden" name="action" value="" class="hidden" />
  <div class="row required" id="row-email">
   <label for="email">Email</label>
   <input name="vendorama_email" type="text" id="email" size="30" value="" maxlength="100" class="text" />
  </div>
  <div class="row required" id="row-password">
   <label for="vendorama_password">Password</label>
   <input type="password" name="vendorama_password" id="vendorama_password" size="30" maxlength="50" class="password" /> 
  </div>
  <div class="row">
   <span class="margin">&nbsp;</span><input type="checkbox" value="4" name="auto_login" id="auto_login" /><label for="auto_login" class="none">Stay logged in</label>
  </div>
  </fieldset>
  <div class="row-optional">
   <span class="margin">&nbsp;</span>
   <input type="submit" name="submit_login" value="Log in" class="button-login" />
  </div><br /><br />
  <div class="row-optional">
   <span class="margin">&nbsp;</span>
   &bull; <a href="/account/new">Create an account</a>
  </div>
  <div class="row-optional">
   <span class="margin">&nbsp;</span>
   &bull; <a href="/login/password/" name="fpass" title="Retrieve your password" rel="Password nofollow">Forget your password?</a>
  </div>
  <span class="highlight-note"></span>
  </form>
 </div>
</div>
<div class="clear"></div>
Links to login, account, cart, checkout
List of category links where category id number is n. E.g. {$LINKS_CATEGORY_3} or {$LINKS_CATEGORY_12} etc.
<p><em>No Products have been added.</em></p>
<p><a href="/vendo/product/">Add a Product</a>.</p>

No Products have been added.

Add a Product.

List of category links, same as {$LINKS_CATEGORIES}
<p><em>No Products have been added.</em></p>
<p><a href="/vendo/product/">Add a Product</a>.</p>

No Products have been added.

Add a Product.

List of footer links
List of groupings links
Where the display_name is the display name of an individual grouping.
List of information links
<div id="links_information1" class="links-information links-information-total-9">
 <ul>
  <li class="link-sell first"><a href="/sell/">Create a Store</a></li>
  <li class="link-features"><a href="/features/">Features</a></li>
  <li class="link-pricing"><a href="/pricing/">Pricing</a></li>
  <li class="link-about"><a href="/about/">About Vendo</a></li>
  <li class="link-terms"><a href="/terms/">Terms of Service</a></li>
  <li class="link-privacy"><a href="/privacy/">Privacy Policy</a></li>
  <li class="link-developers"><a href="/developers/">Developers</a></li>
  <li class="link-contact"><a href="/contact/">Contact Us</a></li>
  <li class="link-request-removal last"><a href="/request-removal/">Request Removal</a></li>
 </ul>
</div>
Links to login, account, cart, checkout
List of customers cart items, also {$ORDER}
List of breadcrumb links
<div class="links-path"><strong class="text-youarehere">You are here: </strong> <span class="link-home"><a href="/" class="link-home">Home</a></span> <span class="path-arrow arrow-1"> &gt; </span> <span class="path-product">Smart Tags</span></div>
List of all products
List of section links: shop, login, account, cart, checkout, about, contact
List of subcategory links when viewing category
List of subcategory links when viewing category
Text displaying either log in or log out, also {$TEXT_LOGIN} Log in
Total number of items in user cart
Number of unique items in user cart
Current category, or subcategory and
Unique page ID code-library
Current section about
Current subsection layout
Page title Smart Tags
Current URL /code-library/?t=1
User's operating system
Current product ID (numeric)
List of categories in a HTML select menu where category id number is n. E.g. {$SELECT_CATEGORY_3} or {$SELECT_CATEGORY_12} etc.
The categories as a HTML select menu
The groupings as a HTML select menu
Name of website from profile, also {$VENDOR_NAME} Vendo
Either your account or create account Create Account
Store country ID (numeric). See the Country Codes for country names. 121
Session vendor ID number 121
Pages viewed in current session for the visitor. 0
Logged in as Wholesaler; 0=no, range: 1-9 0

Templates Markup

show or hide search Smart Tags

A Smart Tag is a variable that starts with { and ends with } and outputs a string of dynamic text. For example {$FIRST_NAME} will display the visitor's first name if they are logged in and blank when they are logged out.

HTML:

<p>Hello {$FIRST_NAME}</p>

Result:

Hello Joe  

You can use Smart Tags in any HTML inputs such as your HTML templates (header.html and footer.html), in product descriptions, info page descriptions and email templates. (Smart Tags will not be parsed in Javascript or CSS files.)

You can use any combination of Smart Tags including $_PAGE variables, $_SESSION variables, $_GET variables, Snippets and __language constants.

By default all Smart Tags are output even if they are empty. You can however use conditional statements to either display or not display a variable or set of variables.

show or hide search Conditional Statements

 {{ ... }} - conditional statement opening and closing tags

Conditional statements start with an opening {{ and end with a closing }} and may also contain an if condition.

You can put any kind of standard HTML, Javascript and CSS inside a conditional statement.

{{
   My first name is {$FIRST_NAME} <br />
   My last name is {$LAST_NAME}
}}

Result:

My first name is Joe 
My last name is Bloggs 

When there is no if condition, all Smart Tags within {{ and }} must return true:

<p>Here is some info about me: <br />

{{
   My first name is {$FIRST_NAME} <br />
   My last name is {$LAST_NAME} <br />
   My middle name is {$MIDDLE_NAME} <br />
}}

I don't have a middle name!</p>

Result:

Here is some info about me: 
I don't have a middle name!

 if - determine whether to display the statement with a condition

An if condition must be after the opening {{ and end with a new line:

{{ if {$FIRST_NAME}

   My first name is {$FIRST_NAME} <br />
   My last name is {$LAST_NAME} <br />
   My middle name is {$MIDDLE_NAME} 
	
}}

Result:

   My first name is Joe 
   My last name is Bloggs 
   My middle name is  

Since we have qualified the statement by requiring only the first name, which returns true, the statement is output even though one of the other Smart Tags is empty.

Using an if condition with a matching value:

Using the == operator in the condition means the variable must match the value exactly:

{{ if {$FIRST_NAME} == 'Joe'

   <p> Welcome {$FIRST_NAME} </p>
	
}}

Result:

   Welcome Joe

This would only be displayed to customers who are logged in and have a first name "Joe".

Using an if condition that doesn't match the value:

{{ if {$FIRST_NAME} != 'Fuzzy Wuzzy'

   <p> Welcome {$FIRST_NAME} </p>
	
}}

Result:

   Welcome Joe  

This also works to check if the Smart Tag is not empty:

{{ if {$FIRST_NAME} != ''

   <p> Welcome {$FIRST_NAME} </p>
	
}}

Result:

   Welcome Joe  

 else - display an alternative when an if condition is false

You can use an else after an if:

{{ if {$COUNTRY_ID} == '40'

   <p> Your country id is 40 which means Tajikistan.</p>

   else
  
   <p> You do not live in is Tajikistan.</p>

}}

Result:

   You do not live in is Tajikistan.

The else condition must appear on its own line:

{{ if {$FIRST_NAME}

   <p> Hello {$FIRST_NAME}.</p>

   else <p> Hello Sir .</p> // else should not have anything after it on the same line 

}}   else  // else must be inside the conditional statement  

 LIKE - check for a partial match in the condition

Using an if condition that has a partial match of the value:

{{ if {$FIRST_NAME} LIKE 'Jo'

   <p> Welcome {$FIRST_NAME} </p>
   
}}

Result:

   Welcome Joe  

A LIKE operator will return true for either a to b or b to a:

{{ if {$FIRST_NAME} LIKE 'Joseph Karen Ben Lisa Dan Joe Mike Mitch'

   <p> Welcome {$FIRST_NAME} </p>
   
}}

Result:

   Welcome Joe  

 NOT LIKE - check for a no match in the condition

For no match we use the operator NOT LIKE:

{{ if {$FIRST_NAME} NOT LIKE 'Joseph Karen Ben Lisa Dan Sean Mike Mitch'

   <p> Welcome {$FIRST_NAME} </p>
   
}}

Result:

   Welcome Joe

 CONTAINS - condition contains a value

For more specifically when only the variable contains the value we can use the operator CONTAINS:

{{ if {$FIRST_NAME} CONTAINS 'Jo'

   <p> Welcome {$FIRST_NAME} </p>
   
}}

Result:

   Welcome Joe

 IN - condition is in a value

For when only the variable is in the value we use the operator IN:

{{ if {$FIRST_NAME} IN 'Bill Joe Sally'

   <p> Welcome {$FIRST_NAME} </p>
   
}}

 | - pipe separated values, (in array)

For an exact match for one of multiple values we use the pipe separator |:

{{ if {$FIRST_NAME} IN 'Bill|Joe|Sally'

   <p> Welcome {$FIRST_NAME} </p>
   
}}

Which means the following will return false:

{{ if {$FIRST_NAME} IN 'Bill|Joes|Sally'

   // Must match one of 'Bill' OR 'Joes' OR 'Sally'
   // Note: this is identical to 
   // if {$FIRST_NAME} == 'Bill|Joes|Sally'
   
   <p> Welcome {$FIRST_NAME} </p>
   
   // 'Joe' is not an exact match for 'Joes' 

   else
   
   <p> no exact match for '{$FIRST_NAME}' </p>
   
}}

Result:

   no exact match for 'Joe'

This is equivelent to the statement

if {$FIRST_NAME} == 'Bill' or {$FIRST_NAME} == 'Joes' or {$FIRST_NAME} == 'Sally'

// or similar to PHP in_array:

if (in_array({$FIRST_NAME}, array("Bill", "Joes", "Sally"))) {

 $_PAGE - parse a $_PAGE variable as a Smart Tag

You can use a $_PAGE variable like a Smart Tag:

{{ if {$_PAGE['section']} == 'about'

   <p> You can also see our contact details on our <a href="/contact/">contact page</a>. </p>
	
}}

 $_SESSION - parse a session variable as a Smart Tag

You can also use $_SESSION variables in conditional statements, or anywhere in a HTML template:

{{ if {$_SESSION['country_id']} == '2'

   <p> Your country id is <b> {$_SESSION['country_id']} </b> which means United States.</p>
	
}}

{{ if {$_SESSION['browser']} !='IE'

   <p> Your browser is <b> {$_SESSION['browser']} </b> which is a good choice.</p>
	
}}

Result:

   Your country id is 2 which means United States.
   Your browser is CCBot which is a good choice.

 $_GET - output a get value from a query string

You can also use $_GET variables within statements:

{{ if {$_GET['vq']} CONTAINS 'phone'
   <p> You searched for <em>{$_GET['vq']}</em> - see also our <a href="/contact/">contact page</a>. 
}}

Result:

   You searched for what is your phone number? - see also our contact page.page</a>. 

 __lang - display a languange constant as a Smart tag

You can use __lang constants in your HTML templates:

<b>{__pricing}</b>:<br />

{{ if {$WHOLESALER}

   {__wholesale_price}: $6.00 
   
   else
   
   {__price}: $12.95  
   
}}

Result:

   Pricing:
   Price: $12.95  

show or hide search Comparison Operators


Operator Meaning Example
== is equal to or matches {{ if{$COUNTRY_ID}=='2' Yes we ship to you! }}
!= is not equal to, does not match {{ if{$COUNTRY_ID}!='2' Sorry we don't ship to you. }}
< is less than {{ if{$VIEWS}<'2' Welcome to our store! }}
> is greater than {{ if{$ORDER_ITEMS}>'0' You have {$ORDER_ITEMS} items in your cart. }}
<= is less than or equal to {{ if{$ORDER_ITEMS_TOTAL}<='50' Spend more than $50 for free shipping. }}
>= is greater than or equal to {{ if{$ORDER_ITEMS_TOTAL}>='50' You qualify for free shipping! }}
LIKE has a match: (e.g. 'ell' will match 'hello' or 'hello' will also match 'ell' ) {{ if{$_GET['vq']} LIKE 'phone' See our contact page for phone numbers }}
NOT LIKE   has no match (or value is empty or NULL) {{ if{$_PAGE['title']} NOT LIKE 'blog' See our blog for updates. // if title is empty will return true }}
CONTAINS variable contains the value: (e.g. 'hello' contains 'ell' but 'ell' does not contain 'hello') {{ if{$_GET['vq']} CONTAINS 'phone' Our phone is 010 101 101 }}
IN   variable is in the value: (e.g. 'ell' is in 'hello' but 'hello' is not in 'ell' ) {{ if{$FIRST_NAME} IN 'Ben Joe Laura' Hello Joe. }}
OR either variable in the condition are required to return true; can also use || {{ if{$FIRST_NAME} OR {$MIDDLE_NAME} Hello Joe. }}
AND   all variables in the condition are required to return true; can also use && {{ if{$FIRST_NAME} AND {$LAST_NAME} Hello Joe Bloggs. }}
! is not: true if not exists; can also use =='' {{ if!{$FIRST_NAME} Please log in. }}
| or: true if any one value {{ if{$PAGE_SUBSECTION} == 'category|product' If subsection is category OR product }}

Determining the booloean value of condition (without a comparison operator), e.g. if {$FIRST_NAME} is similar to PHP:

$a=trim($a); 
if(!empty($a) && (!is_numeric($a) || (is_numeric($a) && $a!=0))) {
   // i.e. is true if it is not empty
   // after whitespace is trimmed
   // and is not equal to zero.
   // The inverse would be
   // if(empty($a) || (is_numeric($a) && $a==0))
}

show or hide search Functions

There are a few basic functions similar to PHP functions:

Function Meaning Examples
include includes a HTML file; can be inside or outside a condtional statement, i.e. anywhere in a template.
By default include from the same directory as the current template, but can be also template_id/filename.html Must be a HTML file with a name ending with ".html"
{ include filename.html } { include 4/filename.html } {{ if{ ..condition.. } { include filename.html } }}
redirect redirects to a URL; Must be inside a condtional statement. Will not redirect to self, limit of 1 redirects per 30 seconds to prevent recursive loop. {{ if{ ..condition.. } { redirect / } }} {{ if{ ..condition.. } { redirect https://www.website.com } }}
date display a PHP date format such as d-m-Y { date 'd-m-Y' } // 20-04-2018 {{ if { date 'm' } =='11' it is nearly Christmas }}

show or hide search Requirements

When a conditional statement has no if condition it can be on one line:

{{ Hello {$FIRST_NAME} this is ok to be on one line since there is no if condition. }}

Result:

   Hello  this is ok to be on one line since there is no if condition.  

The if condition must come immediately after the opening {{ and have a closing }}

{{ <em>this is NOT ok since the if condition must come first. </em>

   if {$FIRST_NAME} 
   something something

}}

Result:

   this is NOT ok since the if condition must come first. if  something something

There can only be one if condition inside a statement, the second occurence here is treated as HTML:

{{

   if {$FIRST_NAME} 
   something

   if {$LAST_NAME} 
   something

}}

Result:

   something if Bloggs something

Instead, start a new statement:

{{

   if {$FIRST_NAME} 
   something

}}

{{
 
   if {$LAST_NAME} 
   something

}}

Result:

   something something

You can place a conditional statement anywhere within in your HTML templates:

<em class="{{ 

   if {$FIRST_NAME} 
   logged-in
   
   else 
   logged-out
   
}}">something something</em>

HTML output:

   <em class="logged-in">something something</em>

Result:

   something something

Comments can appear anywhere in a conditional statement, and can be either a new line with // or within /* and */

<p>{{

   // this is a single line comment and will not be shown
   // its ok to have comments before your if condition
   
   if {$FIRST_NAME}
   
   Hello {$FIRST_NAME} 
   
   /*
      this is another way of inserting 
      hidden comments across multiple 
      lines.
   */
   
   something something 
   
   <!-- an HTML comment is still rendered in the HTML source -->
   
   // extra white space and line returns inside a conditional statement is removed

   
}}</p>

HTML output:

   <p>Hello  something something <!-- an HTML comment is still shown in the source --></p>

Result:

   Hello  something something

You can have multiple variables within if conditions:

{{ if {$BROWSER} {$BROWSER_VERSION} == 'CCBot 2.0'
   <p> Your browser is {$BROWSER} {$BROWSER_VERSION} </p>. 
}}

Result:

   Your browser is CCBot 2.0

if conditions and values don't need to be enclosed by single quotes:

{{
   if {$FIRST_NAME} {$LAST_NAME} == Joe Bloggs 
   
   Hello {$FIRST_NAME} {$LAST_NAME} something something
}}

Result:

   Hello Joe Bloggs something something

You may alternatively use the PHP style tags <? and ?> instead of {{ and }} to open and close a conditional statement:

<?
   
   <p>
    <em>Hello {$FIRST_NAME}</em>
   </p>
   
?>

Result:

   Hello 

Warning: this does not equate to a PHP parser, and all content between <? and ?> is still treated as HTML.