I've always wondered how you separate things like alternating table row background colors. Currently, I assign it in code, but that sucks. HTML::Template doesn't appear to have enough logic features to allow you to do modulus division on each iteration and pick a bgcolor from an array. So I have color definitions in my code - which sucks if the designer wants to change the colors. Of course, then I could use something like a config file or store the colors in a db, but that way, it's separated into 3 different areas instead of just two.
my @colors = ('#FFFFFF', '#F0F0F0');
my $cnt = 1;
foreach my $row (@$list) {
$row->{bgcolor} = $colors[$cnt % 2];
# Assign $row to your template engine or AoH or whatever...
$cnt++;
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|