Skip to content

Commit

Permalink
Fix for view templates using LayoutsView that do not extend a parent …
Browse files Browse the repository at this point in the history
…template.
  • Loading branch information
KrisJordan committed Jul 8, 2009
1 parent aa72313 commit dc60b32
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions recess/recess/framework/helpers/Layout.class.php
Expand Up @@ -29,27 +29,33 @@ public static function draw($template, $context) {
Buffer::to($body);
$context = self::includeTemplate($template, $context);
Buffer::end();
if(!isset($context['body'])) {
$context['body'] = $body;
}
while($parent = array_pop(self::$parentStack)) {
try{
$parentInputs = self::getInputs($parent, 'Layout');
}catch(RecessFrameworkException $e) {
// if(RecessConf::$mode == RecessConf::DEVELOPMENT) {
$trace = array_pop(self::$debugTraces);
throw new RecessErrorException('Extended layout does not exist.', 0, 0, $trace[0]['file'], $trace[0]['line'], $trace[0]['args']);
// } else {
// throw $e;
// }

if(empty(self::$parentStack)) {
echo $body;
return true;
} else {
if(!isset($context['body'])) {
$context['body'] = $body;
}
while($parent = array_pop(self::$parentStack)) {
try{
$parentInputs = self::getInputs($parent, 'Layout');
}catch(RecessFrameworkException $e) {
// if(RecessConf::$mode == RecessConf::DEVELOPMENT) {
$trace = array_pop(self::$debugTraces);
throw new RecessErrorException('Extended layout does not exist.', 0, 0, $trace[0]['file'], $trace[0]['line'], $trace[0]['args']);
// } else {
// throw $e;
// }
}
$context = array_intersect_key($context, $parentInputs);
$context = self::includeTemplate($parent, $context);
}
$context = array_intersect_key($context, $parentInputs);
$context = self::includeTemplate($parent, $context);
// if(RecessConf::$mode == RecessConf::DEVELOPMENT) {
array_pop(self::$debugTraces);
// }
return true;
}
// if(RecessConf::$mode == RecessConf::DEVELOPMENT) {
array_pop(self::$debugTraces);
// }
return true;
}

/**
Expand Down

0 comments on commit dc60b32

Please sign in to comment.