Created
April 7, 2011 19:39
-
-
Save iammerrick/908530 to your computer and use it in GitHub Desktop.
Abstract Template Kohana Controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php defined('SYSPATH') or die('No direct script access.'); | |
| abstract class Controller_Application extends Controller_Template { | |
| public $template = 'templates/application'; | |
| public function before() | |
| { | |
| /* Called before so we have access to $this->template */ | |
| parent::before(); | |
| if($this->auto_render) | |
| { | |
| $this->template->set(array( | |
| 'styles' => array(), | |
| 'scripts' => array() | |
| )); | |
| } | |
| } | |
| public function after() | |
| { | |
| $default_styles = array( | |
| ); | |
| $default_scripts = array( | |
| ); | |
| if($this->auto_render) | |
| { | |
| $this->template->set(array( | |
| 'styles' => array_merge($this->template->styles, $default_styles), | |
| 'scripts' => array_merge($this->template->scripts, $default_scripts) | |
| )); | |
| } | |
| return parent::after(); | |
| } | |
| } // End Application |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment