php Smarty模板生成html文档的方法

前端之家收集整理的这篇文章主要介绍了php Smarty模板生成html文档的方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

下面直接发代码
<div class="codetitle"><a style="CURSOR: pointer" data="4752" class="copybut" id="copybut4752" onclick="doCopy('code4752')"> 代码如下:

<div class="codebody" id="code4752">
<?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);
?>

原文链接:https://www.f2er.com/php/28652.html

猜你在找的PHP相关文章