删除方法
成功提示 public function sucess()
初始化额外文件列表 protected function initOption()
初始化扩展JS protected function initJsFile()
初始化HTML5 protected function init5()
加载HTML5文件 public function inc5()
加载JS文件 public function incJS()
初始化设置文件 protected function initConfig()
删除属性
//模板文件路径
public $tplURL;
//控制器类名
public $className;
//控制器方法名
public $funcName;
//错误详情
public $runErrInfo;
//致命错误标示
public $fateErr = false;
//扩展JS文件路径
public $jsFileURL;
//是否运行在sae下
protected $isSae;
//保存saeSave的资源
protected $saeSave;
删除的文件夹
HTML5缓存文件夹
JS缓存文件夹
所有JS和HTML5功能采用插件的形式在页面使用
使用常量取代include config的形式
mio_lt;?php /** * MioPHP 页面核心类 MioPHP/Run/coreRun.class.php * ============================================================================ * 版权所有 miophp.com保留所有权利。 * 网站地址: http://www.miophp.com * ---------------------------------------------------------------------------- * 许可声明:这是一个开源程序,您可以将本软件的整体或任何部分用于商业用途及再发布。 * ============================================================================ * $Author: 刘立博 (mio@miophp.com) $ * $Date: 2012-11-19 $ */ class coreRun extends Smarty{ //运行信息 public $siteName; //要加载的文件 public $fileInfo = array(mioCfg_cssURL, mioCfg_jqueryURL); public function __construct($title=null, $option=null){ //设置页面标题 $title ? $this-mio_gt;siteName = $title : ''; //判断是否加载更多的文件 if(!empty($option)) $this-mio_gt;initLoadFile($option); $this-mio_gt;checkFile(); //设置smarty parent::__construct(); $this-mio_gt;init(); } //初始化额外加载的文件 protected initLoadFile(mio_amp;$option) { if(is_array($option)){ foreach($option as $v){ if($v == '') continue; $this-mio_gt;fileInfo[] = $v; } } else { $this-mio_gt;fileInfo[] = $option; } } //完成smarty引擎的初始化 public function init(){ //检测smarty是否存在 if(!file_exists(MIO_PATH.'Org/Smarty.class.php')) _err::fate(__FUNCTION__.'运行出错','没有检测到Smarty文件'); $this -mio_gt; template_dir = mioCfg_tplURL; if(mioCfg_MioSae == true){ $this -mio_gt; compile_dir = 'saemc://smarty_c/'; $this -mio_gt; cache_dir = 'saemc://smarty_cache/'; } else { $this -mio_gt; compile_dir = mioCfg_tplURL.'temp/smarty_c/'; $this -mio_gt; cache_dir = mioCfg_tplURL.'temp/smarty_cache/'; } //开始根据设置数据初始化smarty $this -mio_gt; caching = mioCfg_MioSmartyCache; //重要! 在实际运行中此处应该设置为1 $this -mio_gt; cache_lifetime = 3600; $this -mio_gt; left_delimiter = 'mio_lt;{'; $this -mio_gt; right_delimiter = '}mio_gt;'; } //获取html的head头标签信息 public function getHead($type = null){ if($type) return $this-mio_gt;htmlHead(); else return $this-mio_gt;html5Head(); } //返回html5的head信息 protected function html5Head(){ return 'mio_lt;!DOCTYPE htmlmio_gt;mio_lt;htmlmio_gt;mio_lt;headmio_gt;mio_lt;titlemio_gt;'.$this-mio_gt;siteName.'|'.mioCfg_siteName.'mio_lt;/titlemio_gt;mio_lt;meta charset="utf-8" /mio_gt;'.$this-mio_gt;loadHeadFile().'mio_lt;/headmio_gt;'; } //返回xhtml的head信息 protected function htmlHead(){ return 'mio_lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"mio_gt;mio_lt;html xmlns="http://www.w3.org/1999/xhtml"mio_gt;mio_lt;headmio_gt;mio_lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /mio_gt;mio_lt;titlemio_gt;'.$siteName.'|'.mioCfg_siteName.'mio_lt;/titlemio_gt;'.$this-mio_gt;loadHeadFile().'mio_lt;/headmio_gt;'; } //根据额外加载列表里面的信息选择不同方式加载文件 目前只支持CSS和JS加载 protected function loadHeadFile(){ $html .= ''; foreach($this-mio_gt;fileInfo as $val){ if(substr(strtolower($val),-3)=='css'){ $html .= 'mio_lt;link rel="stylesheet" href="'.$val.'" type="text/css" media="screen" /mio_gt;'; }else if(substr(strtolower($val),-2)=='js'){ $html .= 'mio_lt;script src="'.$val.'"mio_gt;mio_lt;/scriptmio_gt;'; } } return $html; } //检查文件是否存在 protected function checkFile(){ //判断模板目录是否存在 if(!file_exists(mioCfg_tplURL)) _err::fate(__FUNCTION__.'运行出错', '模版目录'.mioCfg_tplURL.'不存在'); //判断文件是否存在 foreach($this-mio_gt;fileInfo as $v){ if(!file_exists($v)) _err::fate(__FUNCTION__.'运行出错', '额外加载的文件检测'.$v.'不存在'); } } } ?mio_gt;
上一篇:保存一部我做的比较好的视频 下一篇:快递查询API