fix problem with inserts and nested fetches

This commit is contained in:
mohrt
2003-02-05 22:19:16 +00:00
parent 396d18f5b5
commit 0ce1799133
3 changed files with 20 additions and 2 deletions

2
NEWS
View File

@@ -1,3 +1,5 @@
- fix problem with inserts and nested fetches
(Rainer Collet, Monte)
- added support for passing params to include_php - added support for passing params to include_php
(Tim Riley, Monte) (Tim Riley, Monte)
- added support for math operators in if statements (Monte) - added support for math operators in if statements (Monte)

View File

@@ -1052,6 +1052,11 @@ class Smarty
$this->_inclusion_depth = 0; $this->_inclusion_depth = 0;
if ($this->caching) { if ($this->caching) {
if(!empty($this->_cache_info)) {
// nested call, init cache_info
$_cache_info = $this->_cache_info;
$this->_cache_info = array();
}
if ($this->_read_cache_file($_smarty_tpl_file, $_smarty_cache_id, $_smarty_compile_id, $_smarty_results)) { if ($this->_read_cache_file($_smarty_tpl_file, $_smarty_cache_id, $_smarty_compile_id, $_smarty_results)) {
if (@count($this->_cache_info['insert_tags'])) { if (@count($this->_cache_info['insert_tags'])) {
$this->_load_plugins($this->_cache_info['insert_tags']); $this->_load_plugins($this->_cache_info['insert_tags']);
@@ -1085,9 +1090,12 @@ class Smarty
return $_smarty_results; return $_smarty_results;
} }
} else { } else {
$this->_cache_info = array();
$this->_cache_info['template'][] = $_smarty_tpl_file; $this->_cache_info['template'][] = $_smarty_tpl_file;
} }
if(isset($_cache_info)) {
// restore cache_info
$this->_cache_info = $_cache_info;
}
} }
if (count($this->autoload_filters)) { if (count($this->autoload_filters)) {

View File

@@ -1052,6 +1052,11 @@ class Smarty
$this->_inclusion_depth = 0; $this->_inclusion_depth = 0;
if ($this->caching) { if ($this->caching) {
if(!empty($this->_cache_info)) {
// nested call, init cache_info
$_cache_info = $this->_cache_info;
$this->_cache_info = array();
}
if ($this->_read_cache_file($_smarty_tpl_file, $_smarty_cache_id, $_smarty_compile_id, $_smarty_results)) { if ($this->_read_cache_file($_smarty_tpl_file, $_smarty_cache_id, $_smarty_compile_id, $_smarty_results)) {
if (@count($this->_cache_info['insert_tags'])) { if (@count($this->_cache_info['insert_tags'])) {
$this->_load_plugins($this->_cache_info['insert_tags']); $this->_load_plugins($this->_cache_info['insert_tags']);
@@ -1085,9 +1090,12 @@ class Smarty
return $_smarty_results; return $_smarty_results;
} }
} else { } else {
$this->_cache_info = array();
$this->_cache_info['template'][] = $_smarty_tpl_file; $this->_cache_info['template'][] = $_smarty_tpl_file;
} }
if(isset($_cache_info)) {
// restore cache_info
$this->_cache_info = $_cache_info;
}
} }
if (count($this->autoload_filters)) { if (count($this->autoload_filters)) {