FuelPHP Bin
Sign in
Public
PHP
Save
<?php class Controller_Template extends Controller_Hybrid { public $layout = 'default'; public $template = 'layouts/default'; public $data = array(); public function before() { if (\Input::is_ajax()) { return parent::before(); } // Initial configuration $this->theme = \Theme::instance(); $this->theme->active($this->layout); $this->theme->set_template($this->template); \Debug::dump($this->theme); die; // Get current segments $segments = \Uri::segments(); if (empty($segments)) $segments[0] = 'homepage'; // Set variables $this->data['template']['title'] = 'Site Title'; $this->data['template']['subtitle'] = 'Default subtitle'; $this->data['template']['author'] = 'Default Author'; $this->data['template']['description'] = 'Default description'; $this->data['template']['keywords'] = 'Default keywords'; $this->data['template']['segments'] = $segments; $this->theme->get_template()->set('data', $this->data); // Set template $this->theme->set_partial('navigation', 'partials/navigation'); $this->theme->set_partial('messages', 'partials/messages'); } public function after($response) { if (!\Input::is_ajax()) { \Theme::instance()->set_info('data', $this->data); if (empty($response)) { $response = \Response::forge(\Theme::instance()); } } return parent::after($response); } }