Re: cgi link



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
.



Relevant Pages

  • Re: XML-RPC "filter"
    ... probably get away with modifying the xml directly. ... position of the <params> (i think thats the tag) and insert the xml ...
    (comp.lang.python)
  • RE: Session Cookie
    ... There may be a way to do this by modifying what is in the web.config file, forms tag. ... I set up the path as c:/ and file name for the cookies file in the web.config file, but I can not locate the cookies ... thanks paul. ...
    (microsoft.public.dotnet.framework.aspnet)