Function smarty_compiler_foreachq
Quick foreach template plug-in
This plug-in works as a direct replacement for the original Smarty foreach function.
The difference with foreach is minimal in terms of functionality, but can boost your templates a lot: foreach duplicates the content of the variable that is iterated, to ensure non-array variables can be specified freely. This implementation does not do that, but as a consequence requires that the variable you specify in the from parameter is an array or (when using PHP5) an object. Check the difference between the code generated by foreach and foreachq to understand completely.
Note: to use foreachq, only the opening tag has to be replaced. The closing tab still remains {/foreach}
// Iterate, slow version {foreach from=$array item=elt} {$elt} {/foreach} // Iterate, fast version {foreachq from=$array item=elt} {$elt} {/foreach}
Package: xos\opal\Smarty
Copyright: (c) 2000-2016 XOOPS Project (www.xoops.org)
License: GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
Author: Skalpa Keo skalpa@xoops.org
Located at lass/smarty/xoops_plugins/compiler.foreachq.php
Copyright: (c) 2000-2016 XOOPS Project (www.xoops.org)
License: GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
Author: Skalpa Keo skalpa@xoops.org
Located at lass/smarty/xoops_plugins/compiler.foreachq.php
|
$argStr |
|
|
& $comp |
string
|
string |