Re: [SMARTY] while loop in smarty like ...

From: Date: Tue, 19 Aug 2003 18:16:34 +0000
Subject: Re: [SMARTY] while loop in smarty like ...
References: 1 2  Groups: php.smarty.general php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10097@lists.php.net to get a copy of this message
messju mohr wrote:
with smarty-2.6.0 you can make your block-function-plugins behave like iterators. see: http://smarty.php.net/manual/en/plugins.block.functions.php (i just noticed the fourth parameter "&$repeat" is missing in the function-prototype on that page, i'll update that soon). Thank you. my problem now is:
"Note that the template block will have already been processed by Smarty, so all you will receive is the template output, not the template source." Where comes from my iterator object. Get it from the template or ther parms parameter? I think i didn't understand the principle of block functions. In this template block i want generate a link list to movies like: {$movieIterator->next()->getLink()} The movie Iterators funcrion next() returns an Movie Object. Here my idea for the block function: function smarty_block_movielinklist($params, $content, &$smarty) { $iterator = parms['iterator']; if ($content) {
    do while($repeat = $iterator->next()){
          echo $iterator->next()->getlink();
       }
} } I didn't understand, which value the $contet has. Thank you Greetings Kai P.S. Sorry for my bad english. I hope you understand what my problem is. In german: Vielleicht kann man es ja auch in deutsch per Mail machen
you can test this in 2.6.0-RC1. if your projects timeframe isn't to short a stable release containing this ability may be out when you need it for production. Thats no problem, because my hompage still have development status


« previous php.smarty.general (#10097) next »