Smarty学习之安装篇
来源:互联网 发布:centos 安装twisted 编辑:程序博客网 时间:2024/06/04 19:40
1) 下载smarty安装包,文档 www.smarty.net
2) 将安装包中的lib文件夹放在C:/PHP/PEAR/Smarty/下
3) 在网站根目录下创建templates, templates_c, configs, cache这几个文件夹
4) 在网站根目录下创建setup.php, 配置好smarty
setup.php <?php class MySmarty extends Smarty{
require_once('C:/PHP/PEAR/Smarty/libs/Smarty.class.php');
function MySmarty(){
$this->Smarty();
$this->template_dir = 'templates';
$this->compile_dir = 'templates_c';
$this->config_dir = 'configs';
$this->cache_dir = 'cache';
}
}
?>
5) 在网站根目录下创建index.php, 为模板index.tpl中的变量赋值,并使index.tpl显示
index.php
<?php
require_once('setup.php');
$smarty = new MySmarty();
$smarty->assign('name', 'Mary Hahabao');
$smarty->display('index.tpl');
?>
6) 在templates目录下创建模板文件index.tpl
templates/index.tpl
{* This is index page. *}
Hello {$name}, welcome to Smarty!
7) 在浏览器中运行index.php, 显示
Hello Mary Hahabao, welcome to Smarty!
成功~
- Smarty学习之安装篇
- smarty学习笔记之新手入门
- Smarty学习之基础语法
- php之smarty学习一
- php之smarty学习二
- php之smarty学习三
- php之smarty学习四
- PHP学习之路之Smarty变量
- Smarty学习笔记一:安装与使用
- php模板引擎smarty之安装
- smarty学习笔记之实际小例
- php学习之Smarty——Smarty3
- smarty学习之旅(二)
- Smarty学习之旅(三)
- Smarty安装
- Smarty安装
- 安装Smarty
- 安装smarty
- 北大青鸟代码---asp.net初学者宝典
- java(xfire)调用java编写的webservice
- CfileDialog 文件对话框 mfc打开并读取txt文件
- 详细解析Linux scp命令的应用
- Smarty学习之基础语法
- Smarty学习之安装篇
- 2个结果集的合并--连接的使用
- 对《30个提高Web程序执行效率的好经验》的理解
- PHP FCKEditor的API
- 【转】 Mysql limit 优化,百万至千万级快速分页,--复合索引的引用并应用于轻量级框架
- 【Visual Studio 2010】修改注册表解决误删除某一版本sdk后的编译故障
- awk NR和FNR 环境变量
- 分页的类
- 遍历数组