Learning PHP must not mention the Smarty, as a well-known template program, Smarty naturally has its advantages. Here is my summary of my own a little learning experience it!
=====================================
First download the latest smarty in Smarty.php.net
Put the Libs folder in your Web directory, I placed under Smarty, the directory situation is as follows: E:/smarty/libs
Create the following folder under the Smarty directory:
Templates (Here you put your template file, that is, the TPL file)
Configs
Templates_c (automatically converts the compiled files to PHP in this place)
Cache
Then build the index.php in the Wwwroot directory:
Include "smarty/libs/smarty.class.php";
Define (' __site_root ', ' e:/smarty '); There's no diagonal line.
$TPL = new Smarty ();
$tpl->template_dir = __site_root. "/templates/";
$tpl->compile_dir = __site_root. "/templates_c/";
$tpl->config_dir = __site_root. "/configs/";
$tpl->cache_dir = __site_root. "/cache/";
$tpl->left_delimiter = ' <{'; can be changed as needed.
$tpl->right_delimiter = '}> ';
$tpl->assign (' name ', ' world! ');
$tpl->display (' Index.tpl ')
?>
To create a index.tpl in the template directory:
<title>New Document</title>
hello,{$name}~.
The local index.php then displays the hello,world!~.
http://www.bkjia.com/PHPjc/317624.html www.bkjia.com true http://www.bkjia.com/PHPjc/317624.html techarticle Learning PHP must not mention the Smarty, as a well-known template program, Smarty naturally has its advantages. Here is my summary of my own a little learning experience it! ============= ...