- bugfix on file dependendcy at template inheritance

- bugfix on nocache code at template inheritance
This commit is contained in:
Uwe.Tews
2010-01-07 19:33:18 +00:00
parent 1227de42cc
commit 17a8c7f0a2
4 changed files with 14 additions and 5 deletions

View File

@@ -1,3 +1,7 @@
01/07/2009
- bugfix on file dependency at template inheritance
- bugfix on nocache code at template inheritance
01/06/2009 01/06/2009
- fixed typo in smarty_internal_resource_registered - fixed typo in smarty_internal_resource_registered
- bugfix for custom delimiter at extends resource and {extends} tag - bugfix for custom delimiter at extends resource and {extends} tag

View File

@@ -64,6 +64,7 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase {
$_name = trim($saved_data[0]['name'], "\"'"); $_name = trim($saved_data[0]['name'], "\"'");
if (isset($this->smarty->block_data[$_name])) { if (isset($this->smarty->block_data[$_name])) {
$_tpl = $this->smarty->createTemplate('string:' . $this->smarty->block_data[$_name]['source'], null, null, $compiler->template); $_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->template_filepath = $this->smarty->block_data[$_name]['file'];
$_tpl->forceNocache = true; $_tpl->forceNocache = true;
$_tpl->suppressHeader = 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(); $_output = $compiler->template->extracted_compiled_code . $_tpl->getCompiledTemplate();
} elseif (!empty($this->smarty->block_data[$_name])) { } elseif (!empty($this->smarty->block_data[$_name])) {
$_output = $_tpl->getCompiledTemplate(); $_output = $_tpl->getCompiledTemplate();
} }
$compiler->template->properties['file_dependency'] = array_merge($compiler->template->properties['file_dependency'], $_tpl->properties['file_dependency']); $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->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']); $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; $_output = $compiler->template->extracted_compiled_code;
} }
$compiler->template->extracted_compiled_code = $saved_data[1]; $compiler->template->extracted_compiled_code = $saved_data[1];
$compiler->template->extract_code = $saved_data[2]; $compiler->template->extract_code = $saved_data[2];
return $_output; return $_output;
} }
} }

View File

@@ -443,7 +443,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
} }
} }
$this->rendered_content = ob_get_clean(); $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()); $this->properties['file_dependency'][$this->templateUid] = array($this->getTemplateFilepath(), $this->getTemplateTimestamp());
} }
if ($this->parent instanceof Smarty_Template or $this->parent instanceof Smarty_Internal_Template) { if ($this->parent instanceof Smarty_Template or $this->parent instanceof Smarty_Internal_Template) {

View File

@@ -39,10 +39,14 @@ class Smarty_Internal_TemplateCompilerBase {
*/ */
public function compileTemplate($template) 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 /* here is where the compiling takes place. Smarty
tags in the templates are replaces with PHP code, tags in the templates are replaces with PHP code,
then written to compiled files. */ then written to compiled files. */
// flag for nochache sections // flag for nochache sections
$this->nocache = false; $this->nocache = false;
$this->tag_nocache = false; $this->tag_nocache = false;