Re: counter as a variable

From: Date: Sun, 25 Nov 2001 19:24:49 +0000
Subject: Re: counter as a variable
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2040@lists.php.net to get a copy of this message
> {$images_name[$picnumber]} leads to: Warning: Smarty: [in testcounter.tpl line 9]: syntax error: unknown tag - '$images_name[$picnumber]' in C:\Apache\php4\include\smarty\Smarty_Compiler.class.php on line 981 with "{$images_name[1]}" is everything ok. > Jorge Restrepo - WebTeam wrote: > > > Thanks Monte :) > > > > From: Monte Ohrt [mailto:monte@ispi.net] > > > > >Maybe we could add a new attribute to counter: > > >{counter assign="varname"} > > >{$varname} > > > > Great idea. (math equation ="x + y" assign="varname"} would be also > > very > > useful. > > > > > this is currently one workaround: > > > {capture name="varname"}{counter}{/capture} > > > {$smarty.capture.varname} > > > > It works! :) > > > > However,I thought this should work. But it doesn't: > > > > {counter start=1} > > {capture name="cell"}{counter}{/capture} > > {assign var="picnumber" value=$smarty.capture.cell} > > {$images_name[picnumber]} > > > > There is no output for {$images_sr[picnumber]} eventhough there is a proper > > array for $images_name. > > > > any thoughts? > > > > Thanks > > Jorge > > > > --- > > You are currently subscribed to smarty as: monte@ispi.net > > To unsubscribe send a blank email to $subst('Email.Unsub') > > Visit Smarty's homepage at > > http://www.phpinsider.com/php/code/Smarty/ > > > --- > You are currently subscribed to smarty as: werner.huelsmeier@mbu-online.de > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/

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