In this section we will show you how easily you can download and install Smarty Template in your project.
What are the basic requirements for installation Smarty?
The requirements and installation process are given below:
A web server running PHP 4.0.6 or advance
From the directory of distribution (/libs/) install the Smarty library files.
Architecture of Smarty library files is:
Smarty uses a PHP constant name SMARTY_DIR which is the system file path Smarty library directory. You can set this directory in the php.ini file if you have root access of the system. If you don't have root access to the system then you can copy the smarty library in your project workspace include the Smarty library wherever you need the Smarty framework.
$smarty = new Smarty;
$smarty->caching = true;
$smarty->assign('Article', "Roseindia is a good software Development company");
Quick Guide to install Smarty
Here are the quick steps to download and install the Smarty library into a PHP web application.
Step 1: Download Smarty
Download the Smarty Template Library from http://www.smarty.net/download.php
Step 2: Extract the downloaded .zip file
After extracting the .zip file to your desired folder, for this example I have extracted it into c:\mysmart folder.
Step 3: Create necessary folders
a) Create a new directory (smarty) under www folder of the wamp.
b) Copy the lib directory from the Smarty unzip directory into C:\wamp\www\smarty\ folder.
c) Create three folders namely templates, cache, templates_c under C:\wamp\www\smarty
We will develop and place our template files under templates folder. The cache and templates_c folders are used by the Smarty engine.
Step 4: To create Smarty template:
Now you can develop the .tpl files and then save under the templates directory.
Step 5: To access the php file:
Finally you can use the .tpl file in your PHP program. Now you can start the WAMP server and start developing the program.
In the next section I will show you how you can develop the Hello World application using Smarty Template.
Recommend the tutorial