1, download Smarty template, the official has
2, decompression can, you will have such a directory
In addition to the Libs folder can be deleted (do not know what is the use).
3, in the current directory to create templates, Templates_c, Cache, config folder, other names can also, but need to modify the configuration file
4. Create a folder in the root directory call anything, create a php file, paste the following code into it.
Require_once ("libs/smarty.class.php");
$smarty =new smarty ();
$smarty->template_dir= "Templates";//Specify the path to the template file
$smarty->compile_dir= "Templates_c";//Specify the file path of the compilation
$smarty->cache_dir= "Cache";//Specify Cache file path
$smarty->c C/>
<{$name}>
6, run the PHP file, he absolutely pen error like this
Because of the configuration file path problem, it is better to do so, because the file is not executed in the root directory, so will report this error.
7, the most basic smarty framework is completed, mainly the path of the problem will make mistakes, if it is the following error
This means there is no problem with the introduction of the file, but the configuration is wrong like this, the novice is easily blindfolded.
The above describes the Smarty template Smarty Template Foundation, including the content of the Smarty template, I hope that the PHP tutorial interested in a friend helpful.