- <?php
- /**
- * Displays : 生成静态页
- * Author : phpox
- * Date : Fri Sep 28 10:50:32 CST 2007
- */
- defined('PHPOX') or die(header("HTTP/1.1 403 Not Forbidden"));
- class include_createstatic
- {
- private $htmlPath = '';
- private $path = '';
- public $monthPath = '';
- private $listPath = '';
- private $content = '';
- private $filename = '';
- private $extname = '.html';
- public function createHtml($type,$desName,$content)
- {
- $this->htmlPath = getAppInf('htmlPath');
- if (!file_exists($this->htmlPath))
- {
- @mkdir($this->htmlPath);
- }
- $this->path = $this->htmlPath.$this->monthPath.'/';
- if (!file_exists($this->path))
- {
- @mkdir($this->path);
- }
- $this->listPath = $this->htmlPath.'list/';
- if (!file_exists($this->listPath))
- {
- @mkdir($this->listPath);
- }
- switch ($type)
- {
- case 'index':
- $this->filename = $desName;
- break;
- case 'list':
- $this->filename = $this->listPath.$desName;
- break;
- case 'view':
- $this->filename = $this->path.$desName;
- break;
- }
- $this->filename .= $this->extname;
- $this->content = $content;
- }
- public function write()
- {
- $fp=fopen($this->filename,'wb');
- if (!is_writable($this->filename))
- {
- return false;
- }
- if (!fwrite($fp,$this->content))
- {
- return false;
- }
- fclose($fp);
- return $this->filename;
- }
- }
- ?>
复制代码
|