Ejemplo n.º 1
0
 /**
  * 自动选择路径加文件
  * 规则是:
  * 先从 pri 配置中寻找文件,如果存在,则选择这个路径,
  * 如果不存在,则从 sce 中找,依次类推。
  * 在最后一组配置时不判断文件是否存在,直接选择路径。
  * 返回值是 路径加文件的完整文件名
  * 
  *
  * @param string $sysPathName 系统路径的名称,如 PATH_APP
  * @param string $relPathFilename 相对路径文件名
  * @return string 完整的路径文件名
  */
 public static function getAbsPathFilename($sysPathName, $relPathFilename)
 {
     $pathFile = self::$_priCfg[$sysPathName] . $relPathFilename;
     if (is_array(self::$_secCfg) && !Pft::isReadable($pathFile)) {
         $pathFile = self::$_secCfg[$sysPathName] . $relPathFilename;
     }
     return $pathFile;
 }
Ejemplo n.º 2
0
/**
* 实现在创建对象时,自动加载类定义,即不用include Class文件 Only PHP5
*/
function __autoload($class)
{
    Pft::loadClass($class);
    /*Pft::loadclass2($class);*/
}
Ejemplo n.º 3
0
 /**
  * 渲染
  *
  * @param boolean $show
  * @return string
  */
 public function render($show = true)
 {
     ob_start();
     if (Pft::isReadable($this->_viewFile)) {
         //如果存在 view file, 则提供给他一个 $data 变量
         if (is_array($this->_data)) {
             reset($this->_data);
         }
         $data = $this->_data;
         //在新的分离的目标下,这段分解变量没有什么太大意义了
         /*
         foreach ( $data as $key => $val )
         {
         	//此处根据变量定义render变量
         	//$$key = $this->renderVar( $val , $theCtrl->getVarDef( $key ));
         	$$key = $val;
         	
         	//初始化 $this->_vnameList[]
         	//设置该名称变量的vname 在 renderVar() 里
         	$this->_vnameList[$key] = $key;
         }
         */
         //view file 中,将只看到一个 $data 的输入
         extract($this->_data);
         include $this->_viewFile;
     } else {
         if (DEBUG) {
             //此处使用默认方法render modal
             echo "<pre>";
             echo var_export($this->_data);
             /*
             reset( $this->_data );
             echo htmlspecialchars( Pft_Util_Array::varToXml( $this->_data ) ); 
             */
             /*
             while ( list( $key ) = each( $this->_data ) )
             {
             	echo $$key;
             }
             */
             echo "</pre>";
         }
     }
     $this->_lastOut = ob_get_clean();
     if ($show) {
         echo $this->_lastOut;
     }
     return $this->_lastOut;
 }