Method for generating html documents using the phpSmarty template. Run the following code to copy the code :? Php * file: config_smarty.phpdone: Configure Smartyauthor: www.5dkx. comdate: 2009-12-21 * include_once (.. libssmarty. class. php); directly send code below cl
The code is as follows:
/*
File: config_smarty.php
Done: configure 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", "title ");
$ Smart-> assign ("content", "content ");
$ Smart-> display ('article. tpl ');
$ Output = $ smart-> fetch ('article. tpl ');
$ Path = "../html/1.html ";
$ Fp = fopen ($ Path, "w ");
Fwrite ($ fp, $ output );
Fclose ($ fp );
?>
The pipeline code is as follows :? Php/* file: config_smarty.php done: Configure Smarty author: www.5dkx.com date: 2009-12-21 */include_once ("../libs/smarty. class. php"); cl...