Created
December 15, 2010 20:06
-
-
Save iammerrick/742523 to your computer and use it in GitHub Desktop.
This file contains 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 controller class for automatic templating. | |
* | |
* @package Kohana | |
* @category Controller | |
* @author Kohana Team | |
* @copyright (c) 2008-2009 Kohana Team | |
* @license http://kohanaphp.com/license | |
*/ | |
abstract class Kohana_Controller_Template extends Controller { | |
/** | |
* @var string page template | |
*/ | |
public $template = 'template'; | |
/** | |
* @var boolean auto render template | |
**/ | |
public $auto_render = TRUE; | |
/** | |
* Loads the template [View] object. | |
*/ | |
public function before() | |
{ | |
if ($this->auto_render === TRUE) | |
{ | |
// Load the template | |
$this->template = View::factory($this->template); | |
} | |
return parent::before(); | |
} | |
/** | |
* Assigns the template [View] as the request response. | |
*/ | |
public function after() | |
{ | |
if ($this->auto_render === TRUE) | |
{ | |
$this->request->response = $this->template; | |
} | |
return parent::after(); | |
} | |
} // End Controller_Template |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment