![]() |
|
首页 │ Apache │ Linux│ Java│ MySQL│ 注册│帮助 | |||
有四个文件
index.php
________________________________________________________
<?php
include_once("./Smarty.class.php"); //包含smarty类文件
$smarty = new Smarty(); //建立smarty实例对象$smarty
$smarty->template_dir = "./templates";//设置模板目录
$smarty->compile_dir = "./templates_c"; //设置编译目录
//----------------------------------------------------
//左右边界符,默认为{},但实际应用当中容易与JavaScript
//相冲突,所以建议设成<{}>或其它。
//----------------------------------------------------
$smarty->left_delimiter = "<{";
$smarty->right_delimiter = "}>";
$smarty->assign("name", "李晓"); //进行模板变量替换
//编译并显示位于./templates下的index.tpl模板
$smarty->display("./index.tpl");
?>
_________________________________________________________________________________
foot.tpl
_________________________________________________________

