Forum Moderators: coopster & phranque

Message Too Old, No Replies

HTML::Template question

Custom calendar application

         

runner

3:31 am on Dec 28, 2005 (gmt 0)

10+ Year Member



I have a perl script that uses HTML::Template to create a calendar. There are six rows (weeks) in the table and each row has seven data elements (days of the week) per row.

The problem is that my perl script passes an array (of 42 elements) to the template and loops through all the elements to generate the calendar. However, I cannot figure out how to get HTML::Template to create a new row after seven data elements prints out.

HTML::Template has an IF statement but it's very limited. I need a way to tell when seven items have been processed so I can print the tags /TR TR to start a new row. I only want seven days worth of stuff per table row.

Anybody know how I can do this?

runner

4:45 am on Dec 28, 2005 (gmt 0)

10+ Year Member



I decided it isn't worth it... I'm going to hard code the html in the perl script and skip the HTML::Template module all together.

mikeyb

1:58 pm on Jan 3, 2006 (gmt 0)

10+ Year Member



Hi Runner,

I've done similar things using HTML::Template, that is put a break in after x items.

What you need is another variable in your array for each element, call it new_row for example.

For the 7th element set new_row to 1, all others should be 0

then you can use:
<tmpl_if name=new_row></tr><tr></tmpl_if>

I think that's correct off the top of my head!

runner

5:07 am on Jan 20, 2006 (gmt 0)

10+ Year Member



Thanks mikeyb... I'll remember that for next time. I already re-coded my application. At least I know how to do it next time.