Web development source code: PHP class for generating static pages. Classhtml {var $ dir; dirforthehtmls (without) var $ rootdir; rootofhtmlfiles (without): htmlvar $ name; html file storage path var $ dirname; specified folder name class html
{
Var $ dir; // dir for the htmls (/)
Var $ rootdir; // root of html files (without/): html
Var $ name; // html file storage path
Var $ dirname; // The specified folder name.
Var $ url; // The Source webpage address for retrieving html file information
Var $ time; // time When html file information is added
Var $ dirtype; // Directory storage method: year, month ,,,,
Var $ nametype; // name of the html file: name
Function html ($ nametype = 'name', $ dirtype = 'year', $ rootdir = 'html ')
Function setvar ($ nametype = 'name', $ dirtype = 'year', $ rootdir = 'HTML ')
Function createdir ($ dir = '')
{
$ This-> dir = $ dir? $ Dir: $ this-> dir;
If (! Is_dir ($ this-> dir ))
{
$ Temp = explode ('/', $ this-> dir );
$ Cur_dir = '';
For ($ I = 0; $ I {
$ Cur_dir. = $ temp [$ I]. '/';
If (! Is_dir ($ cur_dir ))
}
}
}
Function getdir ($ dirname = '', $ time = 0)
{
$ This-> time = $ time? $ Time: $ this-> time;
$ This-> dirname = $ dirname? $ Dirname: $ this-> dirname;
Switch ($ this-> dirtype)
{
Case 'name ':
If (empty ($ this-> dirname ))
$ This-> dir = $ this-> rootdir;
Else
$ This-> dir = $ this-> rootdir. '/'. $ this-> dirname;
Break;
Case 'year ':
$ This-> dir = $ this-> rootdir. '/'. date ("Y", $ this-> time );
Break;
Case 'month ':
$ This-> dir = $ this-> rootdir. '/'. date ("Y-m", $ this-> time );
Break;
Case 'day ':
$ This-> dir = $ this-> rootdir. '/'. date ("Y-m-d", $ this-> time );
Break;
}
$ This-> createdir ();
Http://www.bkjia.com/PHPjc/631963.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/631963.htmlTechArticleclass html {var $ dir; // dir for the htmls (without/) var $ rootdir; // root of html files (without/): html var $ name; // html file storage path var $ dirname; // The specified folder name...