Re: [SMARTY] Block function

From: Date: Sun, 23 Mar 2003 20:10:46 +0000
Subject: Re: [SMARTY] Block function
References: 1 2 3  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8854@lists.php.net to get a copy of this message
hello, On Sun, Mar 23, 2003 at 04:47:39PM +0100, Haber Janos wrote: > Hi! > > > {section name=count loop=$var} > > // you have iteration or loop or ... in the doc > > {if $smarty.section.count.iteration<15} > > <DIV ALIGN="{$var[count].align}">{$var[count].text}</DIV> > > {/if} > > {/section} > > I know that, but I want this into own function not in the template. > example: > function smarty_block_repeat($params,$content,&$smarty) > { > for(i=0;i<15;i++) > { > $var["align"]="CENTER"; > $var["text"]="The counter is ".$i; > $this->assign("var",$var); > //And here evaulate expression > eval($content); > } > } this is not possible with the current implementation of smarty's block-functions. i'm pretty sure it will be added to smarty after the release of 2.5.0, which should be soon. you'll have to write your own compiler-functions or insert your own php-stuff (sth. like {php}for($i=0;$i<15;$i++){...{/php} ... {php}}{/php}) in your template to achieve this for now. greetings messju

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