Re: css in cgi generated page

2002-10-11 Thread fliptop

On Thu, 10 Oct 2002 at 22:01, Ian Watt opined:

IW:is there some special trick to linking a style sheet to your page when 
IW:the page is generated by a cgi script?
IW:I have this sub routine that prints the header of a html page:
IW:  sub write_html_header
IW:  {
IW:print Content-type: text/html\n\nhtml\n head\n;
IW:print   link rel='stylesheet' href='mystyle.css' /\n;
IW:print   title$_[0]/title\n;
IW:print /head\nbody\n;
IW:  }
IW:When I run this in a browser it displays the page normally except the 
IW:style sheet isn't applied to the page at all.  It just shows the 
IW:default colors.  I also tried it with the attributes type='text/css' 
IW:and media='screen' but nothing seems to work.  I've tried it in 
[snip]

assuming your mystyle.css file is in your document root, try this:

print   link rel='stylesheet' type='text/css' href='/mystyle.css'\n;

because if you're trying to print this from a file in your cgi-bin, then 
listing the href='mystyle.css' means 'look for the file 
cgi-bin/mystyle.css', and you probably have it in your document root.  
including the leading slash will tell the webserver to look there instead.

also, i'm not sure why you have the extra '/' in there, but perhaps that 
is causing problems also.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




css in cgi generated page

2002-10-10 Thread Ian Watt

is there some special trick to linking a style sheet to your page when 
the page is generated by a cgi script?
I have this sub routine that prints the header of a html page:
  sub write_html_header
  {
print Content-type: text/html\n\nhtml\n head\n;
print   link rel='stylesheet' href='mystyle.css' /\n;
print   title$_[0]/title\n;
print /head\nbody\n;
  }
When I run this in a browser it displays the page normally except the 
style sheet isn't applied to the page at all.  It just shows the 
default colors.  I also tried it with the attributes type='text/css' 
and media='screen' but nothing seems to work.  I've tried it in 
Internet Explorer 6.0, Netscape 7.0, Mozilla 1.2a and Opera 6.05.  The 
stylesheet doesn't work in any browser and I've only used simple style 
attributes, like changing colors and fonts.  I don't believe there is 
anything wrong with the code I have because it works when i link to it 
from a hardcoded html page, so what happening here?

Ian Watt



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]