The solution I have been using is to have page controllers instantiate a template (layout) and then send blocks (view partials) to the template. All along this has assumed only one area for blocks inside of any template. The rest of the template was all interface stuff (I thought). But now, I'm trying to come up with a good way of having the page controller send blocks to various positions in the template.
Here's an example page controller for displaying a Seat in a Committee:
Code: Select all
$seat = new Seat($_GET['seat_id']);
$committee = $seat->getCommittee();
$template = new Template('two-column');
$template->blocks[] = new Block('committees/committeeInfo.inc',
array('committee'=>$committee));
$template->blocks[] = new Block('seats/seatInfo.inc',
array('seat'=>$seat));
$members = new Block('members/memberList.inc');
$members->memberList = $seat->getMembers();
$members->seat = $seat;
$template->blocks[] = $members;
echo $template->render();
But now, the question is how to get blocks to show up in different places in a template, instead of the templates having just one, single content area. It seems like the page controller is going to need to know what areas are available inside of a template.
How have some of you addressed this problem?