[ php ] php smarty使用!
来源:互联网 发布:张宇和陈奕迅 知乎 编辑:程序博客网 时间:2024/06/06 15:43
1 在你的网站目录下创建一个文件夹,名字任意,假设叫smarty_demo:
2 然后再在这个MySmarty目录下创建2个文件夹,templates和configs。
创建完成之后如下: (你的网站目录)/smarty_demo/templates (这个目录用来存放模版)
(你的网站目录)/smarty_demo/configs (这个目录用来存放一些配置信息)
3、在smart_demo目录下再创建两个文件夹,名字分别叫:smarty_cache和smarty_templates_c。为什么刚才不一起创建呢?因为这个步骤在原来的官方资料中没有,而我在配置过P中发现,如果没有这两个文件夹,smarty将无法工作,不知道是不是官方资料的smarty版本和目前最新的版本有出入的原因。但是只要配置这两个目录,Smarty便可以顺利工作。因此建议进行配置。
<?php require('smarty/Smarty.class.php'); $smarty = new Smarty; $smarty->template_dir = 'D:/AppServ/www/smarty_demo/templates/'; $smarty->config_dir = 'D:/AppServ/www/smarty_demo/configs/'; $smarty->cache_dir = 'D:/AppServ/www/smarty_demo/smarty_cache/'; $smarty->compile_dir = 'D:/AppServ/www/smarty_demo/smarty_templates_c/'; $smarty->assign('name','helloword'); $smarty->display('index.tpl');?>
<html> <body> {$name}!; </body></html>
- [ php ] php smarty使用!
- [PHP]Smarty的使用
- php Smarty 使用步骤
- PHP的smarty使用心得!
- PHP中smarty的使用
- PHP使用smarty模板引擎
- smarty里使用php函数
- php:smarty模板的使用
- php smarty
- php smarty
- php smarty
- PHP smarty
- PHP smarty
- PHP smarty
- php smarty
- PHP smarty
- PHP smarty
- PHP smarty
- Microsoft .Net Remoting系列专题之一:.Net Remoting基础篇
- Linux安装JDK详细步骤
- Dijkstra算法
- 创业篇(1)____坚守底线方能美梦成真
- NFC学习——NFC Enable 过程分析(一)
- [ php ] php smarty使用!
- 设计模式总结—工厂三姐妹
- Linux Vim替换字符串的方法总结
- 如何理解oracle的锁
- Microsoft .Net Remoting系列专题之二:Marshal、Disconnect与生命周期以及跟踪服务
- android 正在运行的activity和services
- computer vision:algorithm and application计算机视觉算法与应用 这本书中附录里关于计算机视觉的一些测试数据集和源码站点
- sql 语句 in 注意事项
- 稳定排序和不稳定排序