php Smarty模板生成html文档的方法
2010-04-12 00:00
781 查看
下面直接发代码
<?php /* file:config_smarty.php done:配置Smarty author:www.5dkx.com date:2009-12-21 */ include_once("../libs/smarty.class.php"); class MySmarty extends Smarty{ function __construct() { $this->Smarty(); $this->config_dir = "../config"; $this->cache_dir = "../cache"; $this->template_dir = "../template"; $this->compile_dir = "../template_c"; $this->cache = false; } } $smart = new MySmarty(); $smart->assign("title","标题"); $smart->assign("content","内容"); $smart->display('article.tpl'); $output = $smart->fetch('article.tpl'); $Path = "../html/1.html"; $fp = fopen($Path,"w"); fwrite($fp,$output); fclose($fp); ?>
相关文章推荐
- php Smarty模板生成html文档的方法
- Python使用pyh生成HTML文档的方法示例
- 获得 Win32 窗口句柄的更好的方法 ----动态生成并显示 HTML 文档 ----再谈禁用HTML的上下文菜单...
- 获得 Win32 窗口句柄的更好的方法 ----动态生成并显示 HTML 文档 ----再谈禁用HTML的上下文菜单...
- 获得 Win32 窗口句柄的更好的方法----动态生成并显示 HTML 文档----再谈禁用HTML的上下文菜单...
- 生成HTML新闻页的几点方法
- 四种生成和解析XML文档的方法详解(介绍+优缺点比较+示例)
- 自动把动态的jsp页面(或静态html)生成PDF文档,并且上传至服务器
- 1.0.1 javadoc生成文档时总是报错java.lang.IllegalArgumentException解决方法
- ASP生成html的新方法
- 将word文档转换为html超简单方法
- Java学习笔记——生成doc说明文档的方法
- jQuery实现在HTML文档加载完毕后自动执行某个事件的方法
- Java中四种生成和解析XML文档的方法详解
- HTML文档插入JS代码的几种方法
- Qt使用html生成word文档
- 使用原生JS来改变HTML文档的几种方法
- 使用JQ来改变HTML文档的几种方法
- 使用eclipse生成html格式注释文档 [ javadoc ]