Smarty Template installation configuration, smarty installation configuration _php Tutorial

Source: Internet
Author: User
Tags smarty template

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 ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.