當前位置: 首頁>>代碼示例>>PHP>>正文


PHP View::bind_global方法代碼示例

本文整理匯總了PHP中View::bind_global方法的典型用法代碼示例。如果您正苦於以下問題:PHP View::bind_global方法的具體用法?PHP View::bind_global怎麽用?PHP View::bind_global使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在View的用法示例。


在下文中一共展示了View::bind_global方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: before

 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);
         }
     }
 }
開發者ID:andygoo,項目名稱:cms,代碼行數:29,代碼來源:Material.php

示例2: before

 public function before()
 {
     parent::before();
     $this->_ctx =& Context::instance();
     $this->_ctx->request($this->request)->response($this->response);
     View::bind_global('ctx', $this->_ctx);
 }
開發者ID:ZerGabriel,項目名稱:cms-1,代碼行數:7,代碼來源:front.php

示例3: before

 public function before()
 {
     parent::before();
     $this->session = Session::instance();
     $this->config = Kohana::$config->load('app');
     View::bind_global('app_config', $this->config);
 }
開發者ID:korejwo,項目名稱:coc,代碼行數:7,代碼來源:Core.php

示例4: before

 public function before()
 {
     if ($this->auto_render) {
         $hostArr = explode('.', $_SERVER['HTTP_HOST']);
         $preDomain = $hostArr[0];
         $site = ORM::factory('Site')->where('domain', '=', $preDomain)->find();
         if ($site->loaded()) {
             $this->siteId = $site->id;
             $this->category = ORM::factory('Category')->getAll($site->id, Model_Category::STATUS_SHOW);
             $site = $site->as_array();
             $site['logo'] = '/media/image/data/' . $site['logo'];
             $site['category'] = $this->category;
             $site['author'] = '簡站(Simple-Site.cn) - 免費建站、微信網站、免費微信網站!';
             $site['copyright'] = 'Copyright © 2015 SimpleSite. All Rights Reserved';
             $site['friendLinks'] = ORM::factory('FriendLink')->getAll($site['id']);
             $this->theme = "themes/{$site['theme']}/";
             $this->template = View::factory($this->theme . 'base');
             foreach ($site as $key => $value) {
                 View::bind_global($key, $site[$key]);
             }
         } else {
             echo '404';
             exit;
         }
     }
 }
開發者ID:wangyandong,項目名稱:SimpleSite,代碼行數:26,代碼來源:Base.php

示例5: set_theme

 protected function set_theme()
 {
     View::bind_global('before', $false);
     View::bind_global('navigation', $false);
     View::bind_global('after_navigation', $false);
     View::bind_global('sidebar', $false);
     View::bind_global('pageheader', $false);
     //echo "<pre>";var_dump(Uri::current()); exit;
     //$theme = Utils_Themer::get_theme(Uri::current());
     $theme = Utils_Themer::get_theme($this->request->uri->uri);
     //var_dump($theme); exit;
     $this->template = view::forge($theme['template']);
     View::bind_global('body_attr', $theme['body_attr']);
     Asset::css($theme['css'], array(), 'head_css');
     foreach ($theme['js'] as $js) {
         Casset\Casset::js($js);
     }
     if ($theme['navigation']) {
         $navigation = call_user_func('Utils_Navigation::get_links', $theme['navigation']);
         View::bind_global('navigation', $navigation, false);
     }
     if ($theme['pageheader']) {
         View::bind_global('pageheader', $theme['pageheader']);
     }
 }
開發者ID:sajans,項目名稱:cms,代碼行數:25,代碼來源:base.php

示例6: request_error

 /** 
  * 頁麵及錯誤(Exception)
  * 
  * @param Exception $ex 
  * @param mixed $message
  *
  */
 public static function request_error(Exception $ex = null, $message = null)
 {
     $code = 'error';
     if (!is_null($ex)) {
         $message = $ex->getMessage();
         if (false !== stripos($message, 'Unable to find a route to match the URI') || false !== stripos($message, 'not found on this server')) {
             $code = 404;
         }
         // Log the error
         //    if( $GLOBALS['__mogujie']['log_errors'] ){
         //      Kohana::$log->add(Kohana_Log::ERROR, var_export($ex,true) );
         //  }
     }
     if (empty($message)) {
         $message = 'unkown error';
     }
     View::bind_global('message', $message);
     View::bind_global('exception', $ex);
     $msg = $message . '-' . $ex;
     View::bind_global('msg', $msg);
     $uri = request_uri();
     crond_log("uri:{$uri}; code:{$code}; msg:{$msg}; referer:{$_SERVER['HTTP_REFERER']}", 'request_error.log');
     switch ($code) {
         case 404:
             //header("Status: 404 Not Found"); //header("HTTP/1.0 404 Not Found");
             echo Request::factory("error/404")->execute();
             break;
         default:
             echo Request::factory("error/index")->execute();
             break;
     }
     exit;
 }
開發者ID:slumbersoul,項目名稱:gnw-weixin,代碼行數:40,代碼來源:error.php

示例7: _set_view_globals

 protected function _set_view_globals()
 {
     View::bind_global('site_title', $this->_config->site_title);
     View::bind_global('oUser', $this->_oUser);
     View::set_global('action', $this->request->action());
     View::set_global('welcome', Session::instance()->get('title'));
 }
開發者ID:stecj,項目名稱:sime,代碼行數:7,代碼來源:Serhas.php

示例8: __construct

 public function __construct(Request $req)
 {
     parent::__construct($req);
     $m_role = Model::factory('role');
     $this->role_list = $m_role->getAll(array('status' => 'normal'))->as_array('id');
     View::bind_global('role_list', $this->role_list);
 }
開發者ID:noikiy,項目名稱:kohana,代碼行數:7,代碼來源:Admin.php

示例9: view_prepare

 public function view_prepare()
 {
     $controller = $this->request->controller();
     $action = $this->request->action();
     View::bind_global('controller', $controller);
     View::bind_global('action', $action);
     // Load the template
     if (!$this->template instanceof View) {
         $this->template = View::factory($this->template);
     }
     $this->template->title = $GLOBALS['WEB_TITLE'];
     $this->template->scripts = array();
     //放在頭部的Javascript
     $this->template->scriptscoda = array();
     //放在尾部的Javascript
     $this->template->scriptsglobe = array();
     //放在尾部的全局Javascript
     $this->template->styles = array();
     $this->add_style('reset.css');
     $this->add_style('base.css');
     $this->add_style('globe.css');
     //$this->add_script('jquery-1.7.2.min.js','head');
     $this->add_script('jquery-1.11.2.min.js', 'head');
     $this->add_script('jquery-migrate-1.2.1.min.js', 'head');
     $this->add_script('base.js', 'head');
     $this->add_script('globe.js', 'foot');
     $this->set_keywords($GLOBALS['WEB_KEYWORDS']);
     $this->set_description($GLOBALS['WEB_DESC']);
 }
開發者ID:slumbersoul,項目名稱:gnw-weixin,代碼行數:29,代碼來源:template.php

示例10: before

 public function before()
 {
     parent::before();
     $this->params = Arr::extract($this->request->param(), array('year', 'month', 'day'));
     View::bind_global('params', $this->params);
     View::bind_global('content', $this->content);
 }
開發者ID:noikiy,項目名稱:kohana,代碼行數:7,代碼來源:Log.php

示例11: before

 public function before()
 {
     parent::before();
     View::bind_global('preview', $this->preview);
     if ($this->request->action() === 'index') {
         $this->page = Model_Page::find_by_slug($this->request->param('catcher'));
     } else {
         if (!Can::show()) {
             throw new Kohana_Exception("Permission Denied.");
         }
         $this->preview = TRUE;
         if ($this->request->query('preview') !== NULL) {
             $this->preview = (bool) $this->request->query('preview');
         }
         if ($this->request->query('id_page') !== NULL) {
             $id_page = (bool) $this->request->query('id_page');
             $this->page = Model_Page::factory('Page')->where('id_page', '=', $id_page)->order_by('id', 'DESC')->find();
             dd($this->page);
         } else {
             $page_id = (int) $this->request->param('id');
             $this->page = Model_Page::factory('Page', $page_id);
         }
     }
     View::bind_global('page', $this->page);
     $this->content = $this->page->render_blocks();
 }
開發者ID:huiancg,項目名稱:kohana-huia-pagemanager,代碼行數:26,代碼來源:Page.php

示例12: before

 public function before()
 {
     parent::before();
     View::bind_global('types', $this->types);
     View::bind_global('plats', $this->plats);
     View::bind_global('cities', $this->cities);
 }
開發者ID:andygoo,項目名稱:admin,代碼行數:7,代碼來源:Ad.php

示例13: before

 public function before()
 {
     parent::before();
     // Make $page_title available to all views
     View::bind_global('page_title', $this->page_title);
     // Load $sidebar into the template as a view
     //$this->template->sidebar = View::factory('template/sidebar');
 }
開發者ID:laiello,項目名稱:ko3,代碼行數:8,代碼來源:website.php

示例14: before

 public function before()
 {
     parent::before();
     $this->user = new Model_User();
     $this->config = Kohana::$config->load('app');
     $this->logged_in = Auth::instance()->logged_in();
     View::bind_global('app_config', $this->config);
 }
開發者ID:korejwo,項目名稱:coc,代碼行數:8,代碼來源:User.php

示例15: action_index

 public function action_index()
 {
     $posts = ORM::factory('Post')->order_by('created', 'DESC')->find_all();
     $paginator = Paginator::factory($posts);
     $paginator->set_item_count_per_page(5);
     $paginator->set_current_page_number(Arr::get($_GET, 'page', 1));
     View::bind_global('posts', $paginator);
     $this->template->content = View::factory('blog/index');
 }
開發者ID:DavBfr,項目名稱:BlogMVC,代碼行數:9,代碼來源:Posts.php


注:本文中的View::bind_global方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。