Newbie CGI Question

Jay Dorsey jay at jaydorsey.com
Mon Oct 6 20:47:14 EDT 2003


davedo2 wrote:
> I'm having a problem when writing a cgi script that outputs content
> type: text/html. I can control the color of the screen with print
> '<back bgcolor="some color">' but I can't tile the screen with print
> '<back background="foo.gif">'. Is tiling not an option with Python
> CGI? A push in the right direction would be appreciated.
> 
> I'm using Python 2.2.1 on Windows XP Pro running Apache 2.0.47 as
> localhost for debug purposes. Thanks for any help provided.
> 

Instead of <back... did you mean <body?  Outputting text/html you should 
be using good ole' HTML to style the screen/page.  You can "attach" a 
background image to a page using the background attribute, i.e. <body 
background="foo.gif"> which is similar to the example you showed.  Make 
sure foo.gif is located in the same directory as the page being output. 
  If the script is in ~/cgi-bin, and images are in ~/, you need 
"../foo.gif" or "/foo.gif"; or to add the prefix for the path to the 
image from your docroot "/images/foo.gif".  You can also use the 
absolute path; http://www.mysite.com/path/to/foo.gif.  The image should 
tile automatically; should you need it not to tile you could use CSS.

HTH

Jay






More information about the Python-list mailing list