layout.php should be responsible for including the header and footer I'd say.
It depends on how you set the pages. Anyway it was just an example.
Having it as a config option just adds unneeded complexity.
Not really! If you have a routing class and the routing class has a config file for all the different routes why not have one for the view.
I think ROR does it this way:
Possible options you could have:
Code: Select all
<?php
$option['template'] = 'default.tpl'; // Template to use
$option['id'] = 'content'; // Var name to use with layout
$option['layout'] = 'layout1'; // Layout controller to attach rendered template to
$option['children'] = array(); // Children to load
$option['engine'] = 'smarty'; // Template engine to use
$option['format'] = 'xhtml'; // Ouput format to use could be XHTML, PDF, etc.. (Could be set to automatically add header into the response)
?>
If you have a separate config file you can load different children up with differn't layouts. If it was coded in the layout controller you would have to create a new layout everytime you wanted to show child controllers on some pages and not others.