当前位置: 首页>>代码示例>>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;未经允许,请勿转载。