Transferred from:http://blog.csdn.net/ma332567575/article/details/7904124
First go to www.smarty.net download the latest version of Smarty
Unzip the downloaded package in the root directory of the website
TAR-ZXVF Myindex Smarty.tar.gz
Put the Libs in the extracted folder into the root directory of the website and change the name to Smarty
Then create the following two folders under the root directory templates and Templates_c
Finally, write the index.php code under the root directory as follows:
<?php
Include_once ('./smarty/smarty.class.php '); $smarty = new Smarty ();
$smarty-Template_dir = "./templates"; Template Storage Directory
$smarty-Compile_dir = "./templates_c"; Compiling the Directory
$smarty-Left_delimiter = "{"; Left delimiter
$smarty-Right_delimiter = "}}"; Right delimiter
$smarty-Assign (' Test ', ' OK ');
$smarty, display (' test.html ');
?>
Write the test.html code under the Templates folder as follows
<body>
{{$test}}
</body>
Finally, change the permissions of Templates_c chmod A+XWR Templates_c
Run the index.php test
Okay, show OK.
Smarty's Learning----initial configuration under Ubuntu