php中的Smarty配置
来源:互联网 发布:excel200删除重复数据 编辑:程序博客网 时间:2024/04/29 21:50
WampServer2.1e-x32
1.下载并解压Smarty.我下载的是Smarty-2.6.26.zip,解压后的目录为:E:/myspace/PHP/Smarty-2.6.26
2.在php.ini中配置如下:
; Windows: "/path1;/path2"
;include_path = ".;c:/php/includes"
include_path = ".;E:/myspace/PHP/Smarty-2.6.26/libs"
3.创建模板目录如下:
根目录: E:/myspace/PHP/Smarty_Dirs
模板目录:E:/myspace/PHP/Smarty_Dirs/templates
E:/myspace/PHP/Smarty_Dirs/templates_c
配置目录:E:/myspace/PHP/Smarty_Dirs/configs
缓存目录:E:/myspace/PHP/Smarty_Dirs/cache
4.在模板目录E:/myspace/PHP/Smarty_Dirs/templates中创建模板index.tpl:
<html>
<head><title>{$title}{*这个是注释*}</title></head>
<body>
{$body|count_words}
{$body|capitalize}
</body>
</html>
5.在apache服务器应用目录(E:/myspace/PHP/php_root)中创建Smarty测试目录SmartyTest(E:/myspace/PHP/php_root/SmartyTest).创建测试文件index.php:
<?php
require("Smarty.class.php");
$smarty=new Smarty;
$smarty->template_dir='E:/myspace/PHP/Smarty_Dirs/templates';
$smarty->config_dir='E:/myspace/PHP/Smarty_Dirs/configs';
$smarty->cache_dir='E:/myspace/PHP/Smarty_Dirs/cache';
$smarty->compile_dir='E:/myspace/PHP/Smarty_Dirs/templates_c';
$smarty->assign("title","Smarty Test");
$smarty->assign("body","Hello,This is my first smarty test!");
/*$smarty->assign("title","Smarty测试");
$smarty->assign("body","Hello,这是我的第一个Smarty测试!");*/
$smarty->display("index.tpl");
?>
6.启动服务器(注意前面配置后应重启)测试:http://localhost/SmartyTest/index.php
- php中的Smarty配置
- php smarty的配置
- php之 smarty配置
- PHP Smarty环境配置
- PHP smarty配置
- php配置smarty
- php中的smarty总结
- Smarty的基本配置【smarty.inc.php】
- PHP Smarty实例教程(二):smarty安装配置路径方法
- PHP 中使用 Smarty 之三:Smarty中的保留变量
- php Smarty模板引擎配置与测试
- PHP使用Smarty模板目录结构配置
- php Smarty模板引擎配置与测试
- Smarty模板php配置变量乱码问题
- php smarty模板中的条件判断
- FCKeditor在PHP+SMARTY中的使用
- FCKeditor在PHP+SMARTY中的使用
- 解决 PHP 中的 __autoload 和 Smarty 冲突
- 算法导论 习题 5.4-4
- WCF简介
- 游标示例
- ubuntu安装nginx服务器出错解决
- 抗旱概念股二度被炒 上海、深圳资金成主力
- php中的Smarty配置
- Android Eclipse logcat 只显示一行的问题
- 分享一个快速开发工具的设计界面
- php扩展之关于extension,zend_extension和zend_extension_ts
- 计时器:Chronometer
- 一个sql中常遇到的表结构转换问题
- SQL中on条件与where条件的区别[转]
- 修复ie9 fckeditor2.6 弹出窗口问题
- 坚持自己的路