public function __construct($request = null) { $this->request = $request ? $request : YZE_Request::get_instance(); $this->session = YZE_Session_Context::get_instance(); $this->module = $this->request->module_obj(); // init layout if ($this->request->get_output_format()) { $this->layout = $this->request->get_output_format(); } }
protected function display_self() { $this->data = $this->view->get_datas(); $this->data['content_of_view'] = $this->view->get_output(); $this->data['content_of_section'] = $this->view->view_sections(); if (isset($this->view->layout)) { $this->layout = $this->view->layout; } if (@$_SERVER['HTTP_X_PJAX']) { //pjax 请求,不返回layout echo "<title>" . $this->get_data("yze_page_title") . "</title>"; //pjax 加载时设置页面标题 $this->layout = ""; } if ($this->layout) { if (YZE_Request::get_instance()->is_mobile_client()) { $moblayoutfile = YZE_APP_LAYOUTS_INC . "{$this->layout}.moblayout.php"; if (file_exists($moblayoutfile)) { include $moblayoutfile; return; } } $layoutfile = YZE_APP_LAYOUTS_INC . "{$this->layout}.layout.php"; if (file_exists($layoutfile)) { include $layoutfile; return; } throw new YZE_Resource_Not_Found_Exception(" layout {$moblayoutfile} not found"); } else { echo $this->data['content_of_view']; } }
<?php namespace yangzie; ?> <h1>服务器出现500错误</h1> <?php $exception = $this->get_data("exception"); $request = YZE_Request::get_instance(); ?> <h2 class="page-header"><?php echo $exception->getMessage(); ?> </h2> <p>异常:<?php echo get_class($exception); ?> </p> <p>URI:<?php echo $request->the_uri(); ?> </p> <p>Module:<?php echo $request->module(); ?> </p> <p>CWD:<?php echo getcwd(); ?> </p>
public static function post_cache_has() { $uri = YZE_Request::get_instance()->the_uri(); return YZE_Session_Context::get_instance()->get_post_datas($uri); }
/** * 在当前的地址中增加一个参数并返回地址 * * @param array $args */ public function add_args_into_current_uri(array $args) { $uri = YZE_Request::get_instance()->the_uri(); $query_string = $this->add_args_to_query_string($args); return $uri . "?" . $query_string; }