mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 03:14:27 +02:00
- 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:
@@ -1,4 +1,8 @@
|
||||
===== 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
|
||||
- bugfix getTemplateVars() should return 'null' instead dropping E_NOTICE on an unassigned variable
|
||||
|
||||
|
@@ -46,7 +46,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
|
||||
|
||||
static function saveBlockData($block_content, $block_tag, $template, $filepath)
|
||||
{
|
||||
$_rdl = preg_quote($template->smarty->right_delimiter);
|
||||
$_rdl = preg_quote($template->smarty->right_delimiter);
|
||||
$_ldl = preg_quote($template->smarty->left_delimiter);
|
||||
|
||||
if (0 == preg_match("!({$_ldl}block\s+)(name=)?(\w+|'.*'|\".*\")(\s*?)?((append|prepend|nocache)(=true)?)?(\s*{$_rdl})!", $block_tag, $_match)) {
|
||||
@@ -100,6 +100,8 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// flag that child is already compile by {$smarty.block.child} inclusion
|
||||
$compiler->template->block_data[$_name]['compiled'] = true;
|
||||
}
|
||||
if ($_name == null) {
|
||||
$compiler->trigger_template_error('{$smarty.block.child} used out of context', $this->compiler->lex->taglineno);
|
||||
@@ -108,7 +110,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
|
||||
if (!isset($compiler->template->block_data[$_name])) {
|
||||
return '';
|
||||
}
|
||||
$_tpl = new Smarty_Internal_template ('eval:' . $compiler->template->block_data[$_name]['source'], $compiler->smarty, $compiler->template, $compiler->template->cache_id,
|
||||
$_tpl = new Smarty_Internal_template ('eval:' . $compiler->template->block_data[$_name]['source'], $compiler->smarty, $compiler->template, $compiler->template->cache_id,
|
||||
$compiler->template->compile_id = null, $compiler->template->caching, $compiler->template->cache_lifetime);
|
||||
$_tpl->properties['nocache_hash'] = $compiler->template->properties['nocache_hash'];
|
||||
$_tpl->template_filepath = $compiler->template->block_data[$_name]['file'];
|
||||
@@ -141,7 +143,6 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
|
||||
}
|
||||
}
|
||||
unset($_tpl);
|
||||
$compiler->template->block_data[$_name]['compiled'] = true;
|
||||
return $_output;
|
||||
}
|
||||
|
||||
|
@@ -56,21 +56,11 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C
|
||||
break;
|
||||
|
||||
case 'template':
|
||||
if ($compiler->smarty->inheritance) {
|
||||
$ptr = $compiler->template->parent;
|
||||
} else {
|
||||
$ptr = $compiler->template;
|
||||
}
|
||||
$_template_name = $ptr->template_resource;
|
||||
$_template_name = $compiler->template->template_resource;
|
||||
return "'$_template_name'";
|
||||
|
||||
case 'current_dir':
|
||||
if ($compiler->smarty->inheritance) {
|
||||
$ptr = $compiler->template->parent;
|
||||
} else {
|
||||
$ptr = $compiler->template;
|
||||
}
|
||||
$_template_dir_name = dirname($ptr->getTemplateFilepath());
|
||||
$_template_dir_name = dirname($compiler->template->getTemplateFilepath());
|
||||
return "'$_template_dir_name'";
|
||||
|
||||
case 'version':
|
||||
|
Reference in New Issue
Block a user