Re: cgi link
- From: cdevers@xxxxxxxxx (Chris Devers)
- Date: Wed, 22 Jun 2005 10:11:31 -0400 (EDT)
On Wed, 22 Jun 2005, Brent Clark wrote:
> [I'm] trying to get a line as such:
> <LINK REL=STYLESHEET HREF="/styles/ecco1.css" TYPE="text/css">
You're already using CGI.pm, so why not let it do this for you?
<http://search.cpan.org/dist/CGI.pm/CGI.pm#LIMITED_SUPPORT_FOR_CASCADING_STYLE_SHEETS>
Modifying the code there a bit, this could work:
$newStyle = qq[
<!--
P.Tip {
margin-right: 50pt;
margin-left: 50pt;
color: red;
}
P.Alert {
font-size: 30pt;
font-family: sans-serif;
color: red;
}
-->
];
print $cgi->header(),
$cgi->start_html( -title=>'CGI with Style',
-style=>{-src => '/style/st1.css',
-code => $newStyle}
);
Or, to more directly do what you're trying to do, simply adapt the
section right after the above block:
Any additional arguments passed in the -style value will be
incorporated into the <link> tag. For example:
start_html(-style=>{-src=>['/styles/print.css',
'/styles/layout.css'],
-media => 'all'});
This will give:
<link rel="stylesheet" type="text/css" href="/styles/print.css" media="all"/>
<link rel="stylesheet" type="text/css" href="/styles/layout.css" media="all"/>
Or if you really want something more customized -- the example you give
isn't doing anything exotic, so probably not -- then yes you can use the
$cgi->Link method, but really the CSS-specific stuff is what you need.
--
Chris Devers
.
- References:
- cgi link
- From: Brent Clark
- cgi link
- Prev by Date: RE: how to append blocks in same file
- Next by Date: Re: creating html interface for the perl code
- Previous by thread: cgi link
- Next by thread: Re: cgi link
- Index(es):
Relevant Pages
|