diff --git a/change_log.txt b/change_log.txt index e3c52f20..81a08966 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,3 +1,7 @@ +01/07/2009 +- bugfix on file dependency at template inheritance +- bugfix on nocache code at template inheritance + 01/06/2009 - fixed typo in smarty_internal_resource_registered - bugfix for custom delimiter at extends resource and {extends} tag diff --git a/libs/sysplugins/smarty_internal_compile_block.php b/libs/sysplugins/smarty_internal_compile_block.php index d884fd89..54798ef4 100644 --- a/libs/sysplugins/smarty_internal_compile_block.php +++ b/libs/sysplugins/smarty_internal_compile_block.php @@ -64,6 +64,7 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase { $_name = trim($saved_data[0]['name'], "\"'"); if (isset($this->smarty->block_data[$_name])) { $_tpl = $this->smarty->createTemplate('string:' . $this->smarty->block_data[$_name]['source'], null, null, $compiler->template); + $_tpl->properties['nocache_hash'] = $compiler->template->properties['nocache_hash']; $_tpl->template_filepath = $this->smarty->block_data[$_name]['file']; $_tpl->forceNocache = true; $_tpl->suppressHeader = true; @@ -76,7 +77,7 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase { $_output = $compiler->template->extracted_compiled_code . $_tpl->getCompiledTemplate(); } elseif (!empty($this->smarty->block_data[$_name])) { $_output = $_tpl->getCompiledTemplate(); - } + } $compiler->template->properties['file_dependency'] = array_merge($compiler->template->properties['file_dependency'], $_tpl->properties['file_dependency']); $compiler->template->properties['function'] = array_merge($compiler->template->properties['function'], $_tpl->properties['function']); $compiler->template->required_plugins['compiled'] = array_merge($compiler->template->required_plugins['compiled'], $_tpl->required_plugins['compiled']); @@ -86,7 +87,7 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase { $_output = $compiler->template->extracted_compiled_code; } $compiler->template->extracted_compiled_code = $saved_data[1]; - $compiler->template->extract_code = $saved_data[2]; + $compiler->template->extract_code = $saved_data[2]; return $_output; } } diff --git a/libs/sysplugins/smarty_internal_template.php b/libs/sysplugins/smarty_internal_template.php index 7e82f62d..fab9d084 100644 --- a/libs/sysplugins/smarty_internal_template.php +++ b/libs/sysplugins/smarty_internal_template.php @@ -443,7 +443,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { } } $this->rendered_content = ob_get_clean(); - if (!$this->resource_object->isEvaluated) { + if (!$this->resource_object->isEvaluated && empty($this->properties['file_dependency'][$this->templateUid])) { $this->properties['file_dependency'][$this->templateUid] = array($this->getTemplateFilepath(), $this->getTemplateTimestamp()); } if ($this->parent instanceof Smarty_Template or $this->parent instanceof Smarty_Internal_Template) { diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index 0ee76966..1e927bc7 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -39,10 +39,14 @@ class Smarty_Internal_TemplateCompilerBase { */ public function compileTemplate($template) { - $template->properties['nocache_hash'] = $this->nocache_hash; + if (empty($template->properties['nocache_hash'])) { + $template->properties['nocache_hash'] = $this->nocache_hash; + } else { + $this->nocache_hash = $template->properties['nocache_hash']; + } /* here is where the compiling takes place. Smarty tags in the templates are replaces with PHP code, - then written to compiled files. */ + then written to compiled files. */ // flag for nochache sections $this->nocache = false; $this->tag_nocache = false;