Configuration:
1. Download the latest XAMPP version ;
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: 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
Cod: Selectaţi tot
include_path = ".;C:\xampp\php\pear\"
Cod: Selectaţi tot
include_path = ".;C:\xampp\php\pear\;C:\xampp\smarty\libs\"
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\
"index.php"
Cod: Selectaţi tot
<?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');
?>
Cod: Selectaţi tot
<html>
<body>
Hello, {$name}
<body>
<html>