Smarty is a web template engine for PHP. It is helpful for web project that are performs by different people(e.g. programmer and designer). Smarty separates PHP from HTML, application logic and content from its presentation.
2. Install at C: directory. (C:\xampp)
3. Create a new folder in xampp folder and rename it to smarty. (C:\xampp\smarty)
4. Download the latest Smarty version from http://www.smarty.net/
5. Unzip the content of Smarty zip file to smarty folder. (C:\xampp\smarty)
6. Create two folders templates_c and cache inside it. (C:\xampp\smarty\templates_c and C:\xampp\smarty\cache)
7. Open php.ini file (C:\xampp\php\php.ini), search for Paths and Directories. At Windows part, replace the line
include_path = ".;C:\xampp\php\pear\"
include_path = ".;C:\xampp\php\pear\;C:\xampp\smarty\libs\"
8. Create a new folder in htdocs folder and rename it to smarty. (C:\xampp\htdocs\smarty)
9. Create two folders configs and templates inside it. (C:\xampp\htdocs\smarty\configs and C:\xampp\htdocs\smarty\templates)
10. Smarty configuration is done. Create two scripts index.php and index.tpl to test Smarty template engine.
11. Place index.php inside C:\xampp\htdocs\smarty\ and index.tpl inside C:\xampp\htdocs\smarty\templates\
<?php
// load Smarty library
require('Smarty.class.php');
$smarty = new Smarty;
$smarty-»template_dir = 'C:/xampp/htdocs/smarty/templates';
$smarty-»config_dir = 'C:/xampp/htdocs/smarty/config';
$smarty-»cache_dir = 'C:/xampp/smarty/cache';
$smarty-»compile_dir = 'C:/xampp/smarty/templates_c';
$smarty-»assign('name','Penguin !!');
$smarty-»display('index.tpl');
?>
<html>
<body>
Hello, {$name}
<body>
<html>
12. Open the web browser and type in the URL http://localhost/smarty
Documentation: http://www.smarty.net/docs.php
Reference: http://news.php.net/php.smarty.dev/2703