Home > Backend Development > PHP Tutorial > Smarty template installation configuration, smarty installation configuration_PHP tutorial

Smarty template installation configuration, smarty installation configuration_PHP tutorial

WBOY
Release: 2016-07-13 09:49:24
Original
797 people have browsed it

Smarty template installation configuration, smarty installation configuration

Step 1: Download the Smarty template source code package
Click "Smarty Download" on Baidu to download the latest version of Smarty template
Part 2: Unzip, unzip the downloaded Smarty package
Right-click -> Extract to the current folder... You know ^_^
Part 3: Installation and configuration
1. Enter the decompressed folder, copy the libs folder in the folder to your own working path, and the installation is complete! Is this the installation? Yes, no doubt, this is the installation, haha, it’s simple enough! ^_^
2. Rename the libs folder you just copied to your favorite folder name. I will use the domain name phpname of this site to name it here
3. In the same folder as phpname Create the following new folders in the directory (you can name them yourself, but they must correspond to the configuration in the next step): templates (the directory used to store templates), templates_c (the directory used to store compiled files), cache (Directory used to store cache), config (directory used to store configuration)
4. Create a new smarty.php configuration file in the same directory as phpname (you can also name it by yourself, what name to choose here will be determined later) What name do you want to include in Smarty’s .php file), the code is as follows:
include ('./phpname/Smarty.class.php') ;//Introduce the file class
         $smarty=new Smarty;                                                                                                                         Storage directory
            $smarty->config_dir="config";            $smarty->config_dir="config";                                                                                    Configuration file storage directory
                                                                                                                                             Storage directory ;caching=false; //Turn off caching (set to true to enable caching)
$smarty->left_delimiter="<{"; //Specify the left label
$smarty->right_delimiter="} >"; //Specify the right label
?>
Configuration completed! It’s also very simple! ^_^
Part 4: Test
Now that the installation and configuration are done, let’s test it out
1. Create a new index.html test file in the templates folder. The test code is as follows:
                                                                               
2. Create a new index.php file in the same directory as phpname:
include ("smarty.php"); //Introduce the configuration file
$name="OK "; // Define the variables
$ Smarty- & GT; assign ('name', $ name); // Use the defined variable $ name (" ok ") to replace the & lt; {$ Name} > /localhost/???/phpname/index.php, if the page displays "OK", it means that the Smarty installation and configuration is successful! If "OK" is not displayed, recheck the above steps. I have tested it locally and there is no problem at all! Good luck!

Reprinted 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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template