public function execute() { $view = $this->get_view(); if ($view) { $file = "page/" . mpf_classname_to_path(get_class($this)) . $view . ".phtml"; global $G_LOAD_PATH; foreach ($G_LOAD_PATH as $path) { if (file_exists($path . $file)) { $this->render($path . $file, TRUE); break; } } } }
public function real_component() { $view = $this->get_view(); if ($view) { $file = "component/" . mpf_classname_to_path(get_class($this)) . $view . '.phtml'; global $G_LOAD_PATH; foreach ($G_LOAD_PATH as $path) { if (file_exists($path . $file)) { $this->render($path . $file); break; } } } }
/** * 本方法在页面模板中调用,负责渲染页面的主题内容。 * 跟get_view方法并无区别 */ public function real_page() { $view = $this->get_view(); if ($view) { $file = "page/" . mpf_classname_to_path(get_class($this)) . $view . ".phtml"; global $G_LOAD_PATH; foreach ($G_LOAD_PATH as $path) { if (file_exists($path . $file)) { // 最终页面模板中已经设置了字符集等信息 // 无需再设置 $this->render($path . $file, FALSE); break; } } } }
/** * 载入组件显示页面 */ public function execute() { $view = $this->get_view(); if ($view) { $f = mpf_classname_to_path(get_class($this)) . $view . '.phtml'; $file = "component/" . $f; global $G_LOAD_PATH, $cached_files; if (defined('CACHE_PATH')) { $cf = mpf_class_to_cache_file($f, "component"); if (file_exists($cf)) { $this->render($cf); return; } } foreach ($G_LOAD_PATH as $path) { if (file_exists($path . $file)) { $this->render($path . $file); if (defined('CACHE_PATH')) { mpf_save_to_cache($f, "component", $path . $file); } break; } } } }
public static function use_styles() { $path = mpf_classname_to_path(__CLASS__); return array($path . "Debug.css"); }