This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/includes/kohana/system/classes/Kohana/Controller/Template.php

51 lines
977 B
PHP
Raw Normal View History

2012-11-09 12:18:50 +00:00
<?php defined('SYSPATH') OR die('No direct script access.');
2010-08-21 04:43:03 +00:00
/**
* Abstract controller class for automatic templating.
*
* @package Kohana
* @category Controller
* @author Kohana Team
2012-11-09 12:18:50 +00:00
* @copyright (c) 2008-2012 Kohana Team
2011-05-13 06:00:25 +00:00
* @license http://kohanaframework.org/license
2010-08-21 04:43:03 +00:00
*/
abstract class Kohana_Controller_Template extends Controller {
/**
2011-05-13 06:00:25 +00:00
* @var View page template
2010-08-21 04:43:03 +00:00
*/
public $template = 'template';
/**
* @var boolean auto render template
**/
public $auto_render = TRUE;
/**
* Loads the template [View] object.
*/
public function before()
{
2012-11-09 12:18:50 +00:00
parent::before();
2010-08-21 04:43:03 +00:00
if ($this->auto_render === TRUE)
{
// Load the template
$this->template = View::factory($this->template);
}
}
/**
* Assigns the template [View] as the request response.
*/
public function after()
{
if ($this->auto_render === TRUE)
{
2011-05-13 06:00:25 +00:00
$this->response->body($this->template->render());
2010-08-21 04:43:03 +00:00
}
2012-11-09 12:18:50 +00:00
parent::after();
2010-08-21 04:43:03 +00:00
}
} // End Controller_Template