XOOPS API 2.5.11 Beta1
UI v0.5
Réalisé par monxoops.fr
|
Espaces de nommage | |
xos_opal | |
Fonctions | |
smarty_compiler_foreachq ($argStr, &$comp) | |
smarty_compiler_foreachq | ( | $argStr, | |
& | $comp | ||
) |
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}
$argStr | |
$comp |