php Smarty模板生成html文档的方法
2015-01-24信息快讯网
看过Smarty,感觉这个东西很好用,但是不知道怎么生成html文档。今天在网上查了下,找了方法
下面直接发代码
<?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用SAX解析XML的实现代码与问题分析
PHP IF ELSE简化/三元一次式的使用
PHP表单验证的3个函数ISSET()、empty()、is_numeric()的使用方法
phpmyadmin安装时提示:Warning: require_once(./libraries/common.inc.php)错误解决办法
PHP-CGI进程CPU 100% 与 file_get_contents 函数的关系分析
php Smarty初体验二 获取配置信息
php中Smarty模板初体验
php smarty 二级分类代码和模版循环例子
php smarty 二级分类代码和模版循环例子
在smarty模板中使用PHP函数的方法
php将数据库中所有内容生成静态html文档的代码
php empty函数判断mysql表单是否为空
PHP iconv 解决utf-8和gb2312编码转换问题
让的PHP代码飞起来的40条小技巧(提升php效率)
ajax+php打造进度条代码[readyState各状态说明]
创建数据库php代码 用PHP写出自己的BLOG系统
Smarty Foreach 使用说明
php smarty函数扩展
php Smarty date_format [格式化时间日期]
php 修改zen-cart下单和付款流程以防止漏单
用PHP ob_start()控制浏览器cache、生成html实现代码
php smarty模版引擎中变量操作符及使用方法
php smarty模版引擎中的缓存应用