Home > Article > Backend Development > Installation configuration of smarty template
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 file 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
3. Create the following in the same directory as the phpname folder Several folders (you can name them yourself, but they must correspond to the next step of configuration): templates (the directory used to store templates), templates_c (used to store compiled files), cache (used to store Cached directory), 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 yourself, what name should you choose here when you want to use Smarty. What name is introduced in the php file), the code is as follows:
& lt;? PHP
Include ('./phpname/smarty.class.php'); // Introduce the file class
$ Smarty = New Smarty; // instantiated
$smarty->template_dir="templates"; //Specify the template storage directory
$smarty->compile_dir="templates_c"; //Specify the compiled file storage directory
$smarty->c // $smarty->c //Specify the directory to store the configuration files ... ;{"; //Specify the left label
$smarty->right_delimiter="}>"; // It’s also very simple! ^_^
Part 4: Test
Now that the installation and configuration are done, let’s test if it works
1. Create a new index.html test file in the templates folder. The test code is as follows: