示例#1
0
文件: view.php 项目: rehorn/phppoem
 protected function parseTpl($tpl = '')
 {
     if (is_file($tpl)) {
         return $tpl;
     }
     // list($module,$class,$func) = explode('\\', get_class($this) );
     $tpl = $tpl != '' ? $tpl : POEM_FUNC;
     if (strpos($tpl, '@') !== false) {
         // 模块 Home@Index/index
         list($module, $tpl) = explode('@', $tpl);
         $file = APP_PATH . "{$module}/view/{$tpl}.html";
         // html文件路径
     } elseif (strpos($tpl, ':') !== false) {
         // 指定文件夹 Index/index
         $tpl = str_replace(':', '/', $tpl);
         $file = APP_PATH . POEM_MODULE . "/view/{$tpl}.html";
         // html文件路径
     } else {
         $file = APP_PATH . POEM_MODULE . "/view/" . POEM_CTRL . "/{$tpl}.html";
         // html文件路径
     }
     is_file($file) or \poem\app::halt('文件不存在' . $file);
     return $file;
 }
示例#2
0
function vendor($require_class, $ext = '.php')
{
    static $_file = array();
    if (class_exists($require_class)) {
        return true;
    }
    if (isset($_file[$require_class])) {
        return true;
    }
    $file = VENDOR_PATH . $require_class . $ext;
    if (!is_file($file)) {
        \poem\app::halt('文件不存在: ' . $file);
    }
    $_file[$require_class] = true;
    require $file;
}