- fixed nocache vars at internal block tags

This commit is contained in:
uwe.tews
2009-10-24 08:41:54 +00:00
parent 4914c90e9a
commit f88b868d5a
12 changed files with 50 additions and 14 deletions

View File

@@ -1,3 +1,6 @@
10/24/2009
- fixed nocache vars at internal block tags
10/23/2009
- fixed nocache var problem

View File

@@ -38,7 +38,9 @@ class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase {
// check and get attributes
$_attr = $this->_get_attributes($args);
$this->_open_tag('for');
$this->_open_tag('for', array('for',$this->compiler->nocache));
// maybe nocache because of nocache variables
$this->compiler->nocache = $this->compiler->nocache | $this->compiler->tag_nocache;
$output = "<?php ";
foreach ($_attr['start'] as $_statement) {

View File

@@ -24,8 +24,12 @@ class Smarty_Internal_Compile_ForClose extends Smarty_Internal_CompileBase {
$this->compiler = $compiler;
// check and get attributes
$_attr = $this->_get_attributes($args);
// must endblock be nocache?
if ($this->compiler->nocache) {
$this->compiler->tag_nocache = true;
}
$_open_tag = $this->_close_tag(array('for', 'forelse'));
list($_open_tag, $this->compiler->nocache) = $this->_close_tag(array('for', 'forelse'));
if ($_open_tag == 'forelse')
return "<?php } ?>";
else

View File

@@ -28,7 +28,9 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_CompileBase {
// check and get attributes
$_attr = $this->_get_attributes($args);
$this->_open_tag('foreach');
$this->_open_tag('foreach', array('foreach',$this->compiler->nocache));
// maybe nocache because of nocache variables
$this->compiler->nocache = $this->compiler->nocache | $this->compiler->tag_nocache;
$from = $_attr['from'];
$item = $_attr['item'];

View File

@@ -24,7 +24,13 @@ class Smarty_Internal_Compile_ForeachClose extends Smarty_Internal_CompileBase {
// check and get attributes
$_attr = $this->_get_attributes($args);
$_open_tag = $this->_close_tag(array('foreach', 'foreachelse'));
// must endblock be nocache?
if ($this->compiler->nocache) {
$this->compiler->tag_nocache = true;
}
list($_open_tag, $this->compiler->nocache) = $this->_close_tag(array('foreach', 'foreachelse'));
if ($_open_tag == 'foreachelse')
return "<?php } ?>";
else

View File

@@ -24,8 +24,9 @@ class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase {
// check and get attributes
$_attr = $this->_get_attributes($args);
$this->_close_tag('foreach');
$this->_open_tag('foreachelse');
list($_open_tag, $this->compiler->nocache) = $this->_close_tag(array('foreach'));
$this->_open_tag('foreachelse',array('foreachelse', $this->compiler->nocache));
return "<?php }} else { ?>";
}
}

View File

@@ -25,8 +25,8 @@ class Smarty_Internal_Compile_Forelse extends Smarty_Internal_CompileBase {
// check and get attributes
$_attr = $this->_get_attributes($args);
$this->_close_tag(array('for'));
$this->_open_tag('forelse');
list($_open_tag, $this->compiler->nocache) = $this->_close_tag(array('for'));
$this->_open_tag('forelse',array('forelse', $this->compiler->nocache));
return "<?php }} else { ?>";
}
}

View File

@@ -27,7 +27,9 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_CompileBase {
// check and get attributes
$_attr = $this->_get_attributes($args);
$this->_open_tag('section');
$this->_open_tag('section', array('section',$this->compiler->nocache));
// maybe nocache because of nocache variables
$this->compiler->nocache = $this->compiler->nocache | $this->compiler->tag_nocache;
$output = "<?php ";

View File

@@ -25,7 +25,13 @@ class Smarty_Internal_Compile_SectionClose extends Smarty_Internal_CompileBase {
// check and get attributes
$_attr = $this->_get_attributes($args);
$_open_tag = $this->_close_tag(array('section', 'sectionelse'));
// must endblock be nocache?
if ($this->compiler->nocache) {
$this->compiler->tag_nocache = true;
}
list($_open_tag, $this->compiler->nocache) = $this->_close_tag(array('section', 'sectionelse'));
if ($_open_tag == 'sectionelse')
return "<?php endif; ?>";
else

View File

@@ -25,8 +25,9 @@ class Smarty_Internal_Compile_Sectionelse extends Smarty_Internal_CompileBase {
// check and get attributes
$_attr = $this->_get_attributes($args);
$this->_close_tag('section');
$this->_open_tag('sectionelse');
list($_open_tag, $this->compiler->nocache) = $this->_close_tag(array('section'));
$this->_open_tag('sectionelse',array('sectionelse', $this->compiler->nocache));
return "<?php endfor; else: ?>";
}
}

View File

@@ -25,7 +25,12 @@ class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase {
$this->required_attributes = array('if condition');
// check and get attributes
$_attr = $this->_get_attributes($args);
$this->_open_tag('while');
$this->_open_tag('while', $this->compiler->nocache);
// maybe nocache because of nocache variables
$this->compiler->nocache = $this->compiler->nocache | $this->compiler->tag_nocache;
if (is_array($args['if condition'])) {
$_output = " <?php if (!isset(\$_smarty_tpl->tpl_vars[".$args['if condition']['var']."])) \$_smarty_tpl->tpl_vars[".$args['if condition']['var']."] = new Smarty_Variable;\n";
$_output .= " while (\$_smarty_tpl->tpl_vars[".$args['if condition']['var']."]->value = ".$args['if condition']['value'].") {\n ?>";

View File

@@ -23,7 +23,11 @@ class Smarty_Internal_Compile_WhileClose extends Smarty_Internal_CompileBase {
public function compile($args, $compiler)
{
$this->compiler = $compiler;
$this->_close_tag(array('while'));
// must endblock be nocache?
if ($this->compiler->nocache) {
$this->compiler->tag_nocache = true;
}
$this->compiler->nocache = $this->_close_tag(array('while'));
return "<?php }?>";
}
}