Refer to the data on the network, using Smarty can be easily tested:
1. Unzip the Smarty to the site directory, such as the name Libs.
2. Create a Templates,templates_c,configs,cache directory
3. Build test page: index.php
Require "main.php";
$tpl defined in main.php
$tpl->assign ("title", "page title for Testing");
$tpl->assign ("content", "contents of test pages");
The above two lines can also be used instead of this line
$tpl->assign ("title" + "test page title", "Content" and "content" = "test page contents"));
$tpl->display (' index.htm ');
?>
4. Create a template file under Templates index.htm
<{$title}>
<{$content}>
5. Establish main.php
/* Below this plus if no error is reported:
notice:undefined variable: _session in E:\PHPnow-1.5.1\vhosts\xxh.com\libs\Smarty.class.php on line 585
Don't know why
*/
Session_Start ();//Open session
Include "libs/smarty.class.php";
Define (' __site_root ', ' e:/phpnow-1.5.1/vhosts/xxh.com '); No slash at the end.
$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 = ' <{';
$tpl->right_delimiter = '}> ';
?>
6. Open index.php to test the smarty.