<?php 
class bbs_Config{
	
	var $readHtml;   //读取的HTML模板

	function run(){
	
	/*检测是否载入了模板变量*/
	if(!isset($this->readHtml)){
	die("未载入布局模板!");
	}
	
	/*检测模板文件是否存在*/
	if(!is_file($this->readHtml)){
	die("指定文档无法找寻，请检查路径地址");
	}
	
	if(filectime($this->readHtml) != filemtime($this->readHtml) /*|| !is_file(root_path().'/bbs/inc.php/'.MD5($this->readHtml).'.php')*/){
		$html_contents = file_get_contents($this->readHtml);
	
		/*foreach ($this->value as $key => $value){
			$patt[] = $key;
			$back[] = $value;
		}*/
		$patt = '/\<\{(.+?)\}\>/';
		
		$html = '<?php  echo $GLOBALS[\'\\1\'] ;?>';
		
		$content = preg_replace($patt,$html,$html_contents);
		
		if(!is_dir(root_path.'/bbs/inc.php')){mkdir(root_path.'/bbs/inc.php');}
		
		unlink($this->readHtml);
		
		file_put_contents($this->readHtml,$html_contents);
		
		file_put_contents(root_path().'/bbs/inc.php/'.MD5($this->readHtml).'.php',$content);
		
		include (root_path().'/bbs/inc.php/'.MD5($this->readHtml).'.php');
		
		}else{

		include (root_path().'/bbs/inc.php/'.MD5($this->readHtml).'.php');
			}
		}

}
?>