After reading Smarty, I feel that it is very useful, but I don't know how to generate html documents. I checked it online today and found a method. then I directly sent the code below.
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 );
?>