You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PlexShare/fuel/core/classes/controller/template.php

62 lines
1.1 KiB

<?php
/**
* Part of the Fuel framework.
*
* @package Fuel
* @version 1.8
* @author Fuel Development Team
* @license MIT License
* @copyright 2010 - 2016 Fuel Development Team
* @link http://fuelphp.com
*/
namespace Fuel\Core;
/**
* Template Controller class
*
* A base controller for easily creating templated output.
*
* @package Fuel
* @category Core
* @author Fuel Development Team
*/
abstract class Controller_Template extends \Controller
{
/**
* @var string page template
*/
public $template = 'template';
/**
* Load the template and create the $this->template object
*/
public function before()
{
if ( ! empty($this->template) and is_string($this->template))
{
// Load the template
$this->template = \View::forge($this->template);
}
return parent::before();
}
/**
* After controller method has run output the template
*
* @param Response $response
*/
public function after($response)
{
// If nothing was returned default to the template
if ($response === null)
{
$response = $this->template;
}
return parent::after($response);
}
}