Hello:
Well, I never realized that trying to change a font color, size, and face was going to cause so much controversy...:)
Anyway, I've been modifiying my code and right now it looks as such, I included the whole section of code so you can see what's happening:
push (@row, Tr ({"-align" => "CENTER",
"-valign" => "TOP",
"-BGCOLOR" => "blue",
"-font-color" => "yellow",
"-FONT-FAMILY" => "verdana,
+arial,helvetica",
"-FONT-SIZE" => "12"},
+
th ("I
+tem"),
th ("Quantity"),
th ("Description"),
th ("Unit Price"),
th ("Price")
));
foreach my $item_id (sort (keys (%{$cart_ref})))
{
my $item_ref = $cart_ref->{$item_id};
my $total_item_price = $item_ref->{qty} * $item_ref->{price};
$total_price += $total_item_price;
# generate a link allowing the item to be deleted from the car
+t
my $url = sprintf ("%s?choice=delete;item_id=%s",
url (), escape ($item_id));
push (@row, Tr (
td (escapeHTML ($item_id)),
td (escapeHTML ($item_ref->{qty})),
td (escapeHTML ($item_ref->{description})),
td ({-align => "right"},
escapeHTML (sprintf ("%.2f", $item_ref->{price
+}))),
td ({-align => "right"},
escapeHTML (sprintf ("%.2f", $total_item_price
+))),
+ ($show_links
? td (a ({-href => $url}, img ({-src => "../im
+ages/delete.jpg", -border => "0"})))
+ : td (" "))
));
}
push (@row, Tr (
td ({-colspan => "2"}, ""),
td ({-colspan => "2"}, "Total"),
td ({-align => "right"},
escapeHTML (sprintf ("%.2f", $total_price)))
));
return (table ({-border => 0}, @row));
}
Now, I believe I've incorporated lots of the suggestions but my row with headings have the blue background but it still doesn't want to take the new font color, size, or face.
At least I'm not getting any error messages.
Any other thoughts are greatly appreciated. | [reply] [d/l] |
As I stated before, I think you'd be much better off learning and using CSS for your markup than trying to do it with CGI. You'll get much more consistent results and changes will be a lot easier to make since you'll only have to change one thing in a style sheet rather than who knows how many things in your perl program. Alternately, look into producing your HTML output with HTML::Template rather than CGI. That method would also separate your presentation from your program logic.
| [reply] |
Hi!
Unfortunately, I'm not familiar with either CSS or HTML::Template.
I'll look into it but I'm not sure where to start.
| [reply] |
Hi hbradshaw,
as I pointed out in my earlier post, you should choose either
Tr(
-attr => "value",
"-foo-bar" => "baz"
)
ie, attributes have leading hyphens, are quoted if contain inline hyphens, and are not surrounded by {} brackets,
or
Tr({
attr => "value",
"foo-bar" => "baz"
})
ie, attributes have no leading hyphen, but are contained within {} brackets, making it an anonymous hash. Strings with inline hyphens should still be quoted
The easiest way to fix your code above is to remove the {} brackets from within your Tr().
hope this helps
thinker
| [reply] [d/l] [select] |
Hi hbradshaw, im afraid my involvement in this thread is restircted to the quoting of hash keys. There are others far more able to advise you on the correct uage of CGI than I am.
Good luck however, and a little thought, you may find perltidy from sourceforge (dont have a link handy sorry) to be a useful addition to your tool kit.
Regards,
--- demerphq
my friends call me, usually because I'm late....
| [reply] |