Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

CSS in perl/CGI scripts

  • 14-06-2007 3:52pm
    #1
    Registered Users, Registered Users 2 Posts: 304 ✭✭


    Hi,

    I reckon this should be in programming rather than web design, but it's a close one to call, so if the mods reckon this should be elsewhere, feel free to move it.

    So my question is:

    I have a perl script that churns out a web page. Not being any sort of web designer, it's all done using functions from the CGI.pm module - even for the various tags etc. (I figure that it means that if conventions change, all that needs to be done is to update the CGI module, and it sticks)

    However, I want to make the page use an external CSS file, so it can look purty. Looking at CPAN, I can't see much by way of documentation that says whether it's supported one way or the other.

    Basically I want to get the
    <LINK href="style.css" type=text/css rel=stylesheet>
    
    bit shoved into the header... but preferably using CGI's functions.

    I've googled and I can't really find anything one way or another. Any ideas?

    Thanks,
    Aoife


Comments

  • Registered Users, Registered Users 2 Posts: 6,570 ✭✭✭daymobrew


    print header(), start_html( -title => 'Page Title', -style=>{-verbatim => '@import url("/path/to/stylesheet.css");',-src=>'/path/to/stylesheet.css'} );
    
    produces [HTML]<link rel="stylesheet" type="text/css" href="/path/to/stylesheet.css" />
    <style type="text/css">
    @import url("/path/to/stylesheet.css");
    </style>[/HTML] An example is in the POD documentation for the CGI module.


  • Registered Users, Registered Users 2 Posts: 304 ✭✭PhantomBeaker


    That is perfect - thank you!

    I obviously still need to get the hang of perl documentation. :/

    So it turns out that I got it mostly right before, but I did the inordinately stupid thing of putting it in the header() call rather than the start_html() part.

    D'oh


Advertisement