Re: [htmltmpl] Numeric loops
Brought to you by:
samtregar
From: Dan H. <dan...@re...> - 2007-04-30 00:59:48
|
On Sun, 2007-04-29 at 20:34 -0400, Michael Peters wrote: > Dan Horne wrote: > > Hi all > > > > 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 > > If you're so concerned about doing it in your Perl code, then I'd do it with > Javascript. Create extra image elements depending on the rating value. > Well, I'm not "so" concerned (which to me implies some kind of fervour that I don't think I stated). I was simply asking if there was a way to iterate through integer values that I couldn't see in the POD - simple so the designers could decide what to do with the integer - either iterate from 1 to it, or print it out. Doing it in Perl tends to pre- suppose one solution over the other. The designers don't really have problems with loops - they've used H:T and TT, but I don't think they want to learn Javascript. Thanks Dan |