This demo will show a PHP script using a Smarty template. It assumes basic installation. In the folder where you copy the script, there should be a smarty folder containing the Smarty files. You should create a writable cache
and templates_c
folder, and a folder called templates
where the .tpl
file should be. For example:
/smarty-demo/
smarty/
templates/
arrayTemplate.tpl
templates_c/
cache/
using-smarty.php
The code below shows both files, so make sure you split them. The demo is using arrays and array notation in the template. It is possible to use objects and object notation as well, but I've excluded that here. The template is not using Smarty V3 specifics, so it will be compatible with V2. I hope the comments will provide enough information, if it doesn't, please leave a reply.