Smarty Template installation configuration, smarty installation configuration
The first step: Download Smarty Template Source Package
Baidu "Smarty Download", download the latest version of the Smarty template
Part II: Unzip, unzip the downloaded Smarty package
Right-click Unzip to current Folder ... You know, ^_^.
Part III: Installation and Configuration
1. Go to the Unpacked folder and copy the Libs folder inside the folder to your working path, and the installation is complete! This is the installation? Yes, no doubt, this is the installation, haha, simple enough! ^_^
2. Rename the Libs folder you just copied to your favorite folder name, I will use the name of the site Phpname to name it
3. Create the following folders in the same directory as the Phpname folder (you can start with your own name, but with the next configuration one by one): Templates (the directory used to store the template), Templates_c (the directory used to store the compiled files), Cache (the directory used for caching), config (the directory where the configuration is stored)
4. Create a new smarty.php configuration file in the same directory as the Phpname (you can also start with your name, what name you will introduce in the. php file you want to use Smarty), the code is as follows:
Include ('./phpname/smarty.class.php ');//introduction of File Classes
Instantiation of the $smarty =new smarty;//
$smarty->template_dir= "Templates";//Specify Template storage directory
$smarty->compile_dir= "Templates_c";//Specify the directory where the compiled files are stored
$smarty->config_dir= "config";//Specify the directory where the configuration file resides
$smarty->cache_dir= "Cache";//Specify Cache storage Directory
$smarty->caching=false;//Close Cache (set to true to enable caching)
$smarty->left_delimiter= "<{";//Specify left label
$smarty->right_delimiter= "}>";//Specify Right Label
?>
Configuration Complete! It's easy, too! ^_^
Part fourth: Testing
Installation configuration all done, let's test it.
1. Create a new index.html test file under the Templates folder and test the code as follows:
<{$name}>
2. Create a new index.php file in the same directory as Phpname:
Include ("smarty.php");//introduction of configuration Files
$name = "OK";//define Variable
$smarty->assign (' name ', $name),//Replace the <{in the stencil with the value of the defined variable $name ("OK") $name}>
$smarty->display ("index.html");//Display the index.html in the template folder
?>
3. Open your server, Access http://localhost/???/phpname/index.php, if the page displays "OK", it means Smarty installation configuration is successful! If "OK" is not displayed, re-check the above steps again, the local test, no problem at all! Good luck!
Transfer from http://www.phpname.com/phpname_182013020733.html
http://www.bkjia.com/PHPjc/1020124.html www.bkjia.com true http://www.bkjia.com/PHPjc/1020124.html techarticle smarty Template installation configuration, smarty installation configuration The first step: Download the Smarty version of the source package Baidu smarty Download, download the latest version of the Smarty template Part II: Decompression, the next ...