首页 > 编程知识 正文

phpsmarty配置,php 配置

时间:2024-03-25 09:50:07 阅读:332887 作者:AUQK

本文目录一览:

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

这里是

$smarty-left_delimiter ="{%";

$smarty-right_delimiter ="%}";

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

html

body

b{%$title%}/b

/body

/html

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

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

$smarty-right_delimiter ="}--";

使用smarty需要修改php配置么

使用smarty不需要修改php配置,一般只需要将下载的源代码文件放置于网站目录下,然后再使用时,用require/include引入即可。

示例代码:

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="}";

$smarty2

=

new

smarty;

$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-left_delimiter='{';

$smarty-right_delimiter="}";

不一定几套,

你想弄几套都行,你只要为你实例化的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 //设置缓存的时间

使用一般就assign(); display();

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。