Snippets

Create your own Smart Tags. Set your PHP variables in your PHP files to parse with corresponding Smart Tags in your HTML templates (e.g. template header.html or footer.html) ; (case-sensitive).

Snippets (examples)  Description Result

Snippets allow you to insert blocks of PHP into your HTML templates. Set your variables in your top.inc file, e,g, $snippet1 and $snippet20 and the smart tag equivalents i.e. {$snippet1} and {$snippet20} in your template HTML template.

For example add to your top.inc file:
<?php
$snippet1 = "The date is ".date('d/m/Y')." and the time is ".date('g:ia').".";
?>

In your header.html template file add: {$snippet1}

The date is 22/7/19 and the time is 3:17pm.
<?php
if($_SESSION[country_id]!='121') {
$snippet2 = "<p><strong style=\"color:red\">Note: we do not deliver outside New Zealand.</strong></p>";
}
?>

In your header.html template file add: {$snippet2}

Note: we do not deliver outside New Zealand.

In your top.inc file add:

<?php
if($_SESSION[first_name]) {
      $xyz_custom_name = "<p>Hi ."$_SESSION[first_name].".";
       if(count($_SESSION[order][cart])>0) $xyz_custom_name .= "<br />You have ".count($_SESSION[order][cart])." items in your cart.";
      $xyz_custom_name .= "</p>";
} else {
      $xyz_custom_name .= "<p>You are not logged in.</p>";
}
?>

In your header.html template file add:

<div id="side">
{$xyz_custom_name}
</div>

You can also also create snippets by adding to the $snippets array in top.inc:
<?php
$nights = array('wet', 'moist', 'sultry', 'humid');
shuffle($nights);
$snippets['NIGHTS']=$nights[0];
?>

Then put the equivelent Smart Tag into your template HTML or any page content:
The night was <em>{$NIGHTS}!</em>

The night was sultry!

Hi .
You have 0 items in your cart.