- bugfix nested block tags in template inheritance child templates did not work correctly

- bugfix {$smarty.current_dir} in child template did not point to dir of child template
This commit is contained in:
uwe.tews@googlemail.com
2010-12-11 13:27:14 +00:00
parent ea37403f01
commit cf50ede71a
3 changed files with 12 additions and 17 deletions

View File

@@ -1,4 +1,8 @@
===== SVN trunk ===== ===== SVN trunk =====
11/12/2010
- bugfix nested block tags in template inheritance child templates did not work correctly
- bugfix {$smarty.current_dir} in child template did not point to dir of child template
06/12/2010 06/12/2010
- bugfix getTemplateVars() should return 'null' instead dropping E_NOTICE on an unassigned variable - bugfix getTemplateVars() should return 'null' instead dropping E_NOTICE on an unassigned variable

View File

@@ -100,6 +100,8 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
break; break;
} }
} }
// flag that child is already compile by {$smarty.block.child} inclusion
$compiler->template->block_data[$_name]['compiled'] = true;
} }
if ($_name == null) { if ($_name == null) {
$compiler->trigger_template_error('{$smarty.block.child} used out of context', $this->compiler->lex->taglineno); $compiler->trigger_template_error('{$smarty.block.child} used out of context', $this->compiler->lex->taglineno);
@@ -141,7 +143,6 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
} }
} }
unset($_tpl); unset($_tpl);
$compiler->template->block_data[$_name]['compiled'] = true;
return $_output; return $_output;
} }

View File

@@ -56,21 +56,11 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C
break; break;
case 'template': case 'template':
if ($compiler->smarty->inheritance) { $_template_name = $compiler->template->template_resource;
$ptr = $compiler->template->parent;
} else {
$ptr = $compiler->template;
}
$_template_name = $ptr->template_resource;
return "'$_template_name'"; return "'$_template_name'";
case 'current_dir': case 'current_dir':
if ($compiler->smarty->inheritance) { $_template_dir_name = dirname($compiler->template->getTemplateFilepath());
$ptr = $compiler->template->parent;
} else {
$ptr = $compiler->template;
}
$_template_dir_name = dirname($ptr->getTemplateFilepath());
return "'$_template_dir_name'"; return "'$_template_dir_name'";
case 'version': case 'version':