You set it up just like a TMPL_VAR. If the value of that variable is true (according to Perl's definition of truth), then that section is run. It's just like doing:

if($var) {
    # Do something
}
else {
    # Do something else
}

Except HTML::Template (in its basic form) doesn't provide a way of doing elsif or doing complex comparisons (like $var == 3).

At 11:32 AM 2/17/04 -0800, LDT wrote:
I've read the documentation sections on TMPL_IF and TMPL_ELSE. The part where I'm getting stuck is figuring out how to set up that "BOOL" value. I know if "BOOL" is true, then the section in TMPL_IF is run; if it's false, the section in TMPL_ELSE is run. This sounds like what I want to do (I think...).

I have my results generated and the web page looks nice. However, there are some rows that need to have a different bit of HTML in it (some rows/cells are to be "drillable" and some are not). Unfortunately, it's not just the "last" or "first", etc.; the rows are interspersed in no particular order, some are contiguous, some are stand-alone.

This is where I get stuck. I can tell where I am in Perl when I'm pushing the hash references to the @loop_data (which is subsequently pushed to the template for output), so I can set a variable to something at that time.

How do I set up a variable that the TMPL_IF and TMPL_ELSE can use to determine which section of the HTML loop to process?

I hope this made sense. When you're new, sometimes it's hard to know even how to ask a question! :-)

Thanks!

Lori


Do you Yahoo!?
Yahoo! Finance: <http://us.rd.yahoo.com/evt=22055/*http://taxes.yahoo.com/filing.html>Get your refund fast by filing online



------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ Html-template-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to