123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- /**
- * Abstract controller class for automatic templating.
- *
- * @package KO7
- * @category Controller
- *
- * @copyright (c) 2007-2016 Kohana Team
- * @copyright (c) since 2016 Koseven Team
- * @license https://koseven.dev/LICENSE
- */
- abstract class KO7_Controller_Template extends Controller {
- /**
- * @var View page template
- */
- public $template = 'template';
- /**
- * @var boolean auto render template
- **/
- public $auto_render = TRUE;
- /**
- * Loads the template [View] object.
- */
- public function before()
- {
- parent::before();
- 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)
- {
- $this->response->body($this->template->render());
- }
- parent::after();
- }
- }
|