public function before() { parent::before(); if ($this->auto_render === TRUE) { // Если AJAX запрос, то происходит подмена шаблона, чтобы не выводить лишние данные // Выводится только блок с контентом // шаблон 'ajax/layout' содержит всего одну строчку "<?php echo $content; >" if ($this->request->is_ajax() === TRUE) { $this->template = View::factory('ajax'); } else { $this->template = View::factory($this->template); } $this->template->set_global('title', ''); $this->template->header = View::factory('header')->render(); // В этой переменной будет инициализирован шаблон блока с контентом $this->template->content = ''; $this->template->sidebar = ''; $this->template->footer = View::factory('footer')->render(); // Глобальные стили $this->template->styles = array('public/css/main.css'); //,'public/css/dashicons.css','public/css/genericons.css'); $this->template->scripts = array('public/js/jquery/jquery-1.11.1.min.js', 'public/js/common.js'); // global vars // View::set_global('title', ''); // View::set_global('errors', array()); } }
public function before() { parent::before(); // // http://kohanaframework.org/3.3/guide-api/Request#is_ajax // if( ! $this->request->is_ajax() ) // { // // http://kohanaframework.org/3.3/guide-api/HTTP_Exception // throw new Http_Exception_404(__('Access denied'));//Kohana_Exception('Request is not AJAX'); // } // else // { // $this->_setDataType(); // } $this->_setDataType(); }
/** * Loads the template [View] object. */ public function before() { parent::before(); if ($this->auto_render === TRUE) { if ($this->request->is_ajax() === TRUE) { // Load the template $this->template = View::factory('system/ajax'); } else { $this->template = View::factory($this->template); } // Initialize empty values $this->template->title = NULL; $this->template->content = NULL; $this->breadcrumbs = Breadcrumbs::factory(); $routes = Route::all(); if (isset($routes['backend'])) { $this->breadcrumbs->add(UI::icon('home'), Route::get('backend')->uri()); } $this->init_media(); } }