Code: Select all
<?php
class Action extends Controller {
var $id;
var $parent;
var $children = array();
var $pre_action = array();
var $post_action = array();
var $output;
function render($view) {
foreach ($this->children as $child) {
$child->execute();
$view->set($child->id, $child->output);
}
$this->output = $view->fetch();
}
}
?>
<?php
class ControllerDefault extends Action {
var $id = 'content';
var $parent = 'layout';
function execute() {
$view = new View('default.tpl');
$view->set('title', 'Default');
$this->render($view);
}
}
?>
<?php
class ControllerLayout extends Action {
var $id = 'layout';
var $children = array(
'header',
'footer',
'column'
);
function execute() {
$this->view = new View('layout.tpl');
$this->render($this->view);
}
}
?>I don't think this is the correct way of doing things.
Can anyone please post some examples?
I have see the Zend tutorial example but it does not look like the right way of going about things.
The only other way I can think of is if one of my pages extended from a layout class which would have methods for setting varables like titel, content and mopdules.