<?php
class Controller_Home extends \Controller_Template
{
public function action_index()
{
$this->template->body = \View::forge('home/index', $this->data);
}
public function action_subscribe()
{
$this->template->body = \View::forge('home/subscribe', $this->data);
}
?>
<?php
class Controller_Home extends \Controller_Base
{
public function action_index()
{
//loads views/home/index.php as body-part of the template
}
public function action_subscribe()
{
//loads views/home/subscribe.php as body-part of the template
}
public function action_otherpage()
{
$this->view = 'an/other/view.php';
//loads views/an/other/view.php as body-part of the template
}
?>
<?php
abstract class Controller_Base extends \Controller_Template
{
protected $view = '';
protected $data = array();
public function after($response)
{
if(empty($this->view))
{
$class = \Str::lower(substr(\Inflector::denamespace(\Request::active()->controller), 11));
$method = \Request::active()->action;
$this->view = "{$class}/{$method}";
}
$this->template->body = \View::forge($this->view, $this->data);
parent::after($response);
}
}
It looks like you're new here. If you want to get involved, click one of these buttons!