示例#1
0
 public function before()
 {
     parent::before();
     $lang = $this->request->param('lang');
     // Make sure we have a valid language
     if (!in_array($lang, array_keys(Kohana::config('kohana')->languages))) {
         $this->request->action = 'error';
         throw new Kohana_Request_Exception('Unable to find a route to match the URI: :uri (specified language was not found in config)', array(':uri' => $this->request->uri));
     }
     I18n::$lang = $lang;
     if (isset($this->page_titles[$this->request->action])) {
         // Use the defined page title
         $title = $this->page_titles[$this->request->action];
     } else {
         // Use the page name as the title
         $title = ucwords(str_replace('_', ' ', $this->request->action));
     }
     $this->template->title = $title;
     if (!kohana::find_file('views', 'pages/' . $this->request->action)) {
         $this->request->action = 'error';
     }
     $this->template->content = View::factory('pages/' . $this->request->action);
     $this->template->set_global('request', $this->request);
     $this->template->meta_tags = array();
 }
示例#2
0
文件: Ad.php 项目: andygoo/admin
 public function before()
 {
     parent::before();
     View::bind_global('types', $this->types);
     View::bind_global('plats', $this->plats);
     View::bind_global('cities', $this->cities);
 }
示例#3
0
文件: Material.php 项目: andygoo/cms
 public function before()
 {
     Request::$theme = 'mobile';
     parent::before();
     $is_weixin = false;
     $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
     if (strpos($ua, 'micromessenger') !== false) {
         $is_weixin = true;
     }
     $auth = Auth::instance('member');
     $this->user = $auth->get_user();
     $curr_theme = 'cyan-red';
     if (isset($_COOKIE['apptheme']) && in_array($_COOKIE['apptheme'], array_keys($this->theme_list))) {
         $curr_theme = $_COOKIE['apptheme'];
     }
     $theme_color = $this->theme_list[$curr_theme];
     if ($this->auto_render === TRUE) {
         View::bind_global('is_weixin', $is_weixin);
         View::bind_global('user', $this->user);
         View::bind_global('theme_list', $this->theme_list);
         View::bind_global('theme_color', $theme_color);
         View::bind_global('curr_theme', $curr_theme);
         if ($is_weixin) {
             $wx_js_api = new WeixinJSAPI('test');
             $wx_jsapi_config = $wx_js_api->get_jsapi_config();
             View::bind_global('wx_jsapi_config', $wx_jsapi_config);
         }
     }
 }
示例#4
0
文件: user.php 项目: trie0856/sidemik
 public function before()
 {
     if (in_array(Request::instance()->action, array('login'))) {
         $this->template = 'template/one_column';
     }
     parent::before();
 }
示例#5
0
文件: Auction.php 项目: andygoo/cms
 public function before()
 {
     parent::before();
     $is_weixin = false;
     $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
     if (strpos($ua, 'micromessenger') !== false) {
         $is_weixin = true;
     }
     $auth = Auth::instance('member');
     $this->user = $auth->get_user();
     if ($this->auto_render === TRUE) {
         View::bind_global('is_weixin', $is_weixin);
         View::bind_global('siteinfo', $this->siteinfo);
         View::bind_global('user', $this->user);
         if ($is_weixin) {
             $wx_js_api = new WeixinJSAPI('test');
             $wx_jsapi_config = $wx_js_api->get_jsapi_config();
             View::bind_global('wx_jsapi_config', $wx_jsapi_config);
         }
     }
 }
示例#6
0
 public function before()
 {
     parent::before();
 }
示例#7
0
 public function before()
 {
     $this->template = 'template/one_column';
     parent::before();
 }