Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling CSS file inside perl code 1

Status
Not open for further replies.

thameema

Programmer
Jan 30, 2001
30
0
0
US
can i call Cascading style sheet inside a perl script?
Is there any way to bring style sheet concept inside perl?
 
there is formatting for perl.. lots and lots of it... if you are referring to how it prints stuff. adam@aauser.com
 
If you are referring to just using a CSS document for some HTML that you print out with Perl, all you would have to do it the following:

#!usr/bin/perl

print "Content-type:text/html\n\n";
print &quot;<html><head><title>this is the title</title>\n&quot;;
print &quot;<style>\n&quot;;
print &quot;a {color:black}\n&quot;;
print &quot;a.hover {color:white}\n&quot;;
print &quot;</style></head><body>\n&quot;;
print &quot;</body></html>\n&quot;;


Is that what you were referring to?

Hope this helps,

-Vic vic cherubini
vikter@epicsoftware.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash, Director
====
 
hi vikter,
The code u have given is to write the css inside perl. But what i m expecting is how will u call a external css file inside a perl code?
 
well,

print &quot;<style>\n&quot;;
open(FILE, &quot;stylesheet.css&quot;);
while(<FILE>);
{
print &quot;$_\n&quot;;
}
close(FILE);
print &quot;</style>\n&quot;;
adam@aauser.com
 
will it do the formatting with html code?
 
it will format the code when it is printed to the browser... the browser handles these things... perl just makes the output. adam@aauser.com
 
If you have HTML tags in the Perl script that are outputting to a browser, you can call an external CSS file just as you would with a plain HTML file. Just don't forget to escape any quotes or it will crash. You may or may not need to use &quot;print&quot; depending upon how your HTML section it written. In some, I can do it this way:

[tt]print &quot;<link rel=stylesheet href=\&quot;style.css\&quot; type=\&quot;text/css\&quot;>\n&quot;;[/tt]

While in others, a plain HTML tag will do:

[tt]<link rel=stylesheet href=&quot;style.css&quot; type=&quot;text/css&quot;>[/tt]

The style sheet may need to be located somewhere other than your cgi-bin, in which case, you will need a full or relative path to it.

Don
don@ctagroup.org
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT (only when I have to!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top