1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- /**
- * Part of the Fuel framework.
- *
- * @package Fuel
- * @version 1.5
- * @author Fuel Development Team
- * @license MIT License
- * @copyright 2010 - 2013 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 (empty($response))
- {
- $response = $this->template;
- }
- return parent::after($response);
- }
- }
|