Skip to content

Instantly share code, notes, and snippets.

@iammerrick
Created April 7, 2011 19:39
Show Gist options
  • Select an option

  • Save iammerrick/908530 to your computer and use it in GitHub Desktop.

Select an option

Save iammerrick/908530 to your computer and use it in GitHub Desktop.
Abstract Template Kohana Controller
<?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