Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Using two external style sheets in a CGI.pm script

by grinder (Bishop)
on Jan 28, 2003 at 17:00 UTC ( #230652=snippet: print w/ replies, xml ) Need Help??

Description:

You may already be aware that it is possible to prod CGI into emitting a reference to an external style sheet. For that you have to do the following...

use CGI qw/Link/;

... because the Link method is not exported by default. Once you have done this you can then say:

print $q->start_html({ -head=>Link({-rel=>'stylesheet', -type=>'text/css', -href=>'/foo.c +ss'}), });

And when you look at the HTML you'll see something like <link type="text/css" rel="stylesheet" href="/foo.css" />. I ran into the situation today where I had to include two stylesheets, and the following didn't work:

print $q->start_html({ -head=>Link([ {-rel=>'stylesheet', -type=>'text/css', -href=>'/foo.css'}, {-rel=>'stylesheet', -type=>'text/css', -href=>'/bar.css'}, ]), });

That is, the transitive array reference [ ] trick doesn't work for the Link method. After trying a couple of things out, it turns out that a brute force method below works fine.

This node is dedicated to wil. :)

  print $q->start_html({
      -head=>Link({-rel=>'stylesheet', -type=>'text/css', -href=>'/foo
+.css'})
        . Link({-rel=>'stylesheet', -type=>'text/css', -href=>'/bar.cs
+s'}),
    });
Comment on Using two external style sheets in a CGI.pm script
Download Code
Replies are listed 'Best First'.
Re: Using two external style sheets in a CGI.pm script
by parv (Priest) on Jan 29, 2003 at 01:16 UTC
    hey grinder, i had the exactly same problem but didn't bother to solve/workaround the problem. thanks for your work.

Back to Snippets Section

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: snippet [id://230652]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (19)
As of 2015-07-29 14:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls