Login
网站首页 > 文章中心 > 其它

phpsmarty配置

作者:小编 更新时间:2023-08-16 18:07:38 浏览量:392人看过

最基本的php的smarty的配置问题,快疯了

这里是

$smarty-left_delimiter ="{%";

$smarty-right_delimiter ="%}";

边界符带了个%,所以后面也必须带%

html

body

b{%$title%}/b

/body

/html

不过smarty边界符一般这样设置:

$smarty-left_delimiter?="!--{";

$smarty-right_delimiter?="}--";

使用smarty需要修改php配置么

示例代码:

require 'smarty/libs/Smarty.class.php';

php smarty前后台模板路径的配置问题

$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对象做相应的设置就行啦.

PHP 中 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相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!

版权声明:倡导尊重与保护知识产权。未经许可,任何人不得复制、转载、或以其他方式使用本站《原创》内容,违者将追究其法律责任。本站文章内容,部分图片来源于网络,如有侵权,请联系我们修改或者删除处理。

编辑推荐

热门文章