Re: Numeric loops

Sven Neuhaus <[email protected]> Wed, 02 May 2007 10:54:43 +0200
Newsgroups gmane.comp.lang.perl.modules.html-template
Message-ID <[email protected]>
Dan Horne wrote:
> Is there a way to loop from a lower integer to an higher one? For example,
> say an article has a rating of 4. I'd like to loop from 1 to 4 and print a
> star at each iteration. The only way I can see of doing this is create an
> array ref in the perl coder and pass that to the template, which seems a lot
> of pointless effort 

In this particular case I'd suggest you create 6 graphics (with 1-6 stars)
and use something like
<img src="stars<TMPL_VAR NAME="stars">.gif"
 alt="<TMPL_VAR NAME="stars"> stars">

-Sven

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/