Forum Moderators: coopster & phranque

Message Too Old, No Replies

Adding bg image to perl auction script

         

stcrim

2:33 am on Apr 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am trying to do a little formatting of the output of an auction script. The first info is how the script actually is. The second on is my attempt to add a background image.

It didn't work, can anyone point me in the right direction?

-s-

print "<TR><TD ALIGN=CENTER COLSPAN=2 BGCOLOR=$config{'subcategorycolor'}><B>Auction Sub Categories<br>$backto</B></TD></TR>

print "<tr><td width="100%" bgcolor="#800000" background="http\://www.mysite.com/images/bg-mrn\.gif"><B>Auction Sub Categories<br>$backto</B></TD></TR>";

Birdman

2:48 am on Apr 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try this, stcrim:

print "<tr><td style='width: 100%; background-color: #800000; background-image: url(/images/bg-mrn.gif);'><strong>Auction Sub Categories<br />$backto</strong></td></tr>";

Using CSS to style the <td>. Join us over in CSS, we'd love to see you over there!

Fischerlaender

9:49 am on Apr 28, 2003 (gmt 0)

10+ Year Member



print "<tr><td width="100%" bgcolor="#800000" background="http\://www.mysite.com/images/bg-mrn\.gif"><B>Auction Sub Categories<br>$backto</B></TD></TR>";

You have to escape the quotation marks within the printed string. Use something like this:

print "<tr><td width=\"100%\" bgcolor=\"#800000\" 
background=\"http\://www.mysite.com/images/bg-mrn\.gif\">
<B>Auction Sub Categories<br>$backto</B></TD></TR>";

andreasfriedrich

10:15 am on Apr 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Or you could take advantage of Perl [perl.com]´s quoting operators that save you from having to escape double quotes within you string.


print [perldoc.com] q [perldoc.com]q{<tr><td width="100%" bgcolor="#800000"
background="http\://www.mysite.com/images/bg-mrn\.gif"
><B>Auction Sub Categories<br>$backto</B></TD></TR>};

The q [perldoc.com]q operator acts just like double quotes but lets you choose the delimiter freely: qq/aaron/, qq¦aaron¦, aa{aaron} are all sytactically equivalent to "aaron".

You could use heredoc syntax as well:


print [perldoc.com] <<END_OF_HTML;
<tr><td width="100%" bgcolor="#800000"
background="http\://www.mysite.com/images/bg-mrn\.gif"
><B>Auction Sub Categories<br>$backto</B></TD></TR>
END_OF_HTML

Andreas