这里是
$smarty-left_delimiter ="{%";
$smarty-right_delimiter ="%}";
边界符带了个%,所以后面也必须带%
html
body
b{%$title%}/b
/body
/html
不过smarty边界符一般这样设置:
$smarty-left_delimiter?="!--{";
$smarty-right_delimiter?="}--";
示例代码:
require 'smarty/libs/Smarty.class.php';
$smarty=new
smarty;
$smarty-template_dir=base_path.smarty_path."templates/";
$smarty-compile_dir=base_path.smarty_path."templates_c/";
$smarty-config_dir=base_path.smarty_path."configs/";
$smarty-cache_dir=base_path.smarty_path."cache/";
//定义定界符
$smarty-left_delimiter='{';
$smarty-right_delimiter="}";
=
new
$smarty-template_dir=front_path.smarty_path."templates/";
$smarty-compile_dir=front_path.smarty_path."templates_c/";
$smarty-config_dir=front_path.smarty_path."configs/";
$smarty-cache_dir=front_path.smarty_path."cache/";
不一定几套,
你想弄几套都行,你只要为你实例化的smarty对象做相应的设置就行啦.
首先要加载smarty类:Smarty.class.php
然后实例化这类:如$smarty=new Smarty()
主要的几个基本配置:
$smarty-template_dir //设置模板目录
$smarty - compile_dir //设置编译目录
$smarty - config_dir //设置配置文件目录
$smarty- caching //设置缓存状态
$smarty- cache_dir //设置缓存的路径
$smarty - debugging //是否允许调试
$smarty - left_delimiter //设置左定界符
$smarty- right_delimiter //设置右定界符
$smarty - cache_lifetime //设置缓存的时间
以上就是土嘎嘎小编为大家整理的phpsmarty配置,php相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!