RE: [SMARTY] break out of foreach-loop
| From: | Ferdinand Beyer | Date: | Tue, 06 Aug 2002 12:27:19 +0000 |
| Subject: | RE: [SMARTY] break out of foreach-loop | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5596@lists.php.net to get a copy of this message | ||
On 6 Aug 2002 at 12:38, Peter Billen wrote:
> break; ?
I think that guy means a {foreach} tag inside a template :-).
Well the answer is easy - such a function is missing. If you really
need it (normally such logic should be in your php scripts, not in your
templates...), write your own (compiler) plugins for that.
<?php
// compiler.break.php
function smarty_compiler_break($contents, &$smarty)
{
return 'break;';
}
?>
<?php
//compiler.continue.php
function smarty_compiler_continue($contents, &$smarty)
{
return 'continue;';
}
?>
Create these two files and put them into your plugins directory
(notice the naming convention compiler.xxx.php). Now, you should
be able to leave foreach and section loops with {break} and to leave
out one step with {continue}.
--
Ferdinand Beyer
<fbeyer@clickhand.de>