- update template inheritance processing

This commit is contained in:
uwetews
2015-09-14 23:46:17 +02:00
parent 71c1b32c51
commit 8d734a9d52
8 changed files with 59 additions and 35 deletions
@@ -65,9 +65,6 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
*/
public function compile($args, Smarty_Internal_SmartyTemplateCompiler $compiler, $parameter)
{
if (!isset($parameter['isChild'])) {
$parameter['isChild'] = false;
}
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
@@ -101,6 +98,9 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
} else {
$variable_template = true;
}
if ($compiler->inheritanceForceChild) {
$hashResourceName .= '-child';
}
if (isset($_attr['assign'])) {
// output will be stored in a smarty variable instead of being displayed
@@ -223,7 +223,9 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
$tpl->compiled = new Smarty_Template_Compiled();
$tpl->compiled->nocache_hash = $compiler->parent_compiler->template->compiled->nocache_hash;
$tpl->loadCompiler();
$tpl->isChild = $parameter['isChild'];
$tpl->compiler->inheritanceChild =
$tpl->compiler->inheritanceForceChild = $compiler->inheritanceForceChild;
$tpl->compiler->inheritance = $compiler->inheritance;
// save unique function name
$compiler->parent_compiler->mergedSubTemplatesData[$hashResourceName][$t_hash]['func'] =
$tpl->compiled->unifunc = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
@@ -237,6 +239,8 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
$tpl->compiler->compileTemplate($tpl,
null,
$compiler->parent_compiler));
$compiler->inheritanceParentIsChild = $tpl->compiler->inheritanceChild;
$compiler->inheritance = $tpl->compiler->inheritance;
unset($tpl->compiler);
// remove header code