FuelPHP Bin
<?php class Controller_dashboard extends \Controller { public function before() { parent::before(); // load the theme template $this->theme = \Theme::instance(); // Setting up theme_data array for basic variables. $theme_data['asset_path'] = Uri::base(false).$this->theme->asset_path(''); // set the page template $this->theme->set_template('templates\base_templates'); //Passing Important Variables to Templates $this->theme->get_template() ->set('theme_data', $theme_data); // Setting up Global Mandatory partial in base_template $this->theme->set_partial('global_mandatory','partial\level1\global_mandatory') ->set('theme_data',$theme_data); // Setting up theme_styles partial in base_template $this->theme->set_partial('theme_styles','partial\level1\theme_styles') ->set('theme_data',$theme_data); // Setting up top_nav partial in base_template $app_data = array(); $this->theme->set_partial('top_nav','partial\level1\top_nav') ->set('theme_data',$theme_data) ->set('app_data',$app_data); $app_data = array(); // Setting up sidebar_menu partial in base_template $app_data = array(); $this->theme->set_partial('sidebar_menu','partial\level1\sidebar_menu') ->set('theme_data',$theme_data) ->set('app_data',$app_data) ->set('sidebar_menu',Model_Menu::query()->where('name', '=', 'sidebar_menu')->get_one()->dump_tree()); $app_data = array(); // Setting up main_content partial in base_template $app_data = array(); $this->theme->set_partial('main_content','partial\level1\main_content') ->set('theme_data',$theme_data) ->set('app_data',$app_data); $app_data = array(); // Setting up quick_sidebar partial in base_template $app_data = array(); $this->theme->set_partial('quick_sidebar','partial\level1\quick_sidebar') ->set('theme_data',$theme_data) ->set('app_data',$app_data); $app_data = array(); // Setting up footer partial in base_template $app_data = array(); $this->theme->set_partial('footer','partial\level1\footer') ->set('theme_data',$theme_data) ->set('app_data',$app_data); $app_data = array(); // Setting up ie_top partial in base_template $this->theme->set_partial('ie_top','partial\level1\ie_top') ->set('theme_data',$theme_data); // Setting up ie_bottom partial in base_template $this->theme->set_partial('ie_bottom','partial\level1\ie_bottom') ->set('theme_data',$theme_data); // Setting up core_plugins partial in base_template $this->theme->set_partial('core_plugins','partial\level1\core_plugins') ->set('theme_data',$theme_data); } public function action_index() { } /** * keep the after() as standard as possible to allow custom responses from actions */ public function after($response) { // If no response object was returned by the action, if (empty($response) or ! $response instanceof Response) { // render the defined template $response = \Response::forge(\Theme::instance()->render()); } return parent::after($response); } }