Home >Backend Development >PHP Tutorial >Smarty installation and configuration method_PHP tutorial
Download the latest Smarty: http://smarty.php.net/
The latest version: 2.6.18
After unzipping, rename the libs directory in the directory to smarty, copy it to your website directory, and at the same time Create two directories, templates and templates_c, in the root directory of the website
Create test.php with the following content:
include_once('./Smarty/Smarty.class.php');$smarty = new Smarty();
$smarty -> template_dir = "./templates"; //Template storage directory
$smarty -> compile_dir = "./templates_c"; //Compilation directory
$ smarty -> left_delimiter = "{{"; //Left delimiter
$smarty -> right_delimiter = "}}"; //Right delimiter
$smarty -> assign('test ','OK');
$smarty -> display('test.html');
?>
Give templates_c permission 755
Create a new test in the templates directory. html: