Home >Backend Development >PHP Tutorial >How to generate html documents from php Smarty template_PHP tutorial

How to generate html documents from php Smarty template_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:39:33964browse

下面直接发代码

复制代码 代码如下:

/*
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);
?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/321558.htmlTechArticle下面直接发代码 复制代码 代码如下: ?php /* file:config_smarty.php done:配置Smarty author:www.5dkx.com date:2009-12-21 */ include_once("../libs/smarty.class.php"); cl...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn