diff options
author | Mario Vavti <mario@mariovavti.com> | 2015-12-06 21:09:58 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2015-12-06 21:09:58 +0100 |
commit | 26c465ad0c1d5b6801507ed190430f44ac92c672 (patch) | |
tree | 9e80c34da1235e6dd55942c23bf9511fac31344d /library/Smarty/libs/sysplugins/smarty_internal_compile_for.php | |
parent | f2d70831838b0738e6895296f3e8ce02f86fec2f (diff) | |
download | volse-hubzilla-26c465ad0c1d5b6801507ed190430f44ac92c672.tar.gz volse-hubzilla-26c465ad0c1d5b6801507ed190430f44ac92c672.tar.bz2 volse-hubzilla-26c465ad0c1d5b6801507ed190430f44ac92c672.zip |
update smarty to 3.1.28-dev which fixes a bug where changes in a template are only visible on the second pageload which is annoying for developing
Diffstat (limited to 'library/Smarty/libs/sysplugins/smarty_internal_compile_for.php')
-rw-r--r-- | library/Smarty/libs/sysplugins/smarty_internal_compile_for.php | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_compile_for.php b/library/Smarty/libs/sysplugins/smarty_internal_compile_for.php index 5bac55011..7b86d4859 100644 --- a/library/Smarty/libs/sysplugins/smarty_internal_compile_for.php +++ b/library/Smarty/libs/sysplugins/smarty_internal_compile_for.php @@ -34,6 +34,7 @@ class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase */ public function compile($args, $compiler, $parameter) { + $compiler->loopNesting++; if ($parameter == 0) { $this->required_attributes = array('start', 'to'); $this->optional_attributes = array('max', 'step'); @@ -44,7 +45,7 @@ class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase // check and get attributes $_attr = $this->getAttributes($compiler, $args); - $output = "<?php "; + $output = "<?php\n"; if ($parameter == 1) { foreach ($_attr['start'] as $_statement) { if (is_array($_statement['var'])) { @@ -54,8 +55,8 @@ class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase $var = $_statement['var']; $index = ''; } - $output .= " \$_smarty_tpl->tpl_vars[$var] = new Smarty_Variable;"; - $output .= " \$_smarty_tpl->tpl_vars[$var]->value{$index} = $_statement[value];\n"; + $output .= "\$_smarty_tpl->tpl_vars[$var] = new Smarty_Variable;\n"; + $output .= "\$_smarty_tpl->tpl_vars[$var]->value{$index} = {$_statement['value']};\n"; } if (is_array($_attr['var'])) { $var = $_attr['var']['var']; @@ -64,7 +65,7 @@ class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase $var = $_attr['var']; $index = ''; } - $output .= " if ($_attr[ifexp]) { for (\$_foo=true;$_attr[ifexp]; \$_smarty_tpl->tpl_vars[$var]->value{$index}$_attr[step]) {\n"; + $output .= "if ($_attr[ifexp]) {\nfor (\$_foo=true;$_attr[ifexp]; \$_smarty_tpl->tpl_vars[$var]->value{$index}$_attr[step]) {\n"; } else { $_statement = $_attr['start']; if (is_array($_statement['var'])) { @@ -148,6 +149,7 @@ class Smarty_Internal_Compile_Forclose extends Smarty_Internal_CompileBase */ public function compile($args, $compiler, $parameter) { + $compiler->loopNesting--; // check and get attributes $_attr = $this->getAttributes($compiler, $args); // must endblock be nocache? @@ -157,10 +159,11 @@ class Smarty_Internal_Compile_Forclose extends Smarty_Internal_CompileBase list($openTag, $compiler->nocache) = $this->closeTag($compiler, array('for', 'forelse')); - if ($openTag == 'forelse') { - return "<?php } ?>"; - } else { - return "<?php }} ?>"; - } + $output = "<?php }\n"; + if ($openTag != 'forelse') { + $output .= "}\n"; + } + $output .= "?>\n"; + return $output; } } |