1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Unable to link css file when using HTML::Template

Discussion in 'Perl' started by Rakish, Aug 7, 2006.

  1. Rakish

    Rakish New Member

    Joined:
    Jun 30, 2006
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    0
    Hi all,

    I am having a hard time linking a css file to a template when using the HTML::Template Module.

    Here is what i have:

    1) myserver/cgi-bin folder, which has all the .pl files.
    2) myserver/html folder, which has the template, CSS and html files

    the template files have extension .tmpl

    If i call an external CSS file like below:

    It doesnt work,

    but if i embed the same CSS code in the:


    then it works fine.

    I have tried my best, and i dont want to give up on it.

    Please help.

    Thankyou so much.

    Rakesh Gupta
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
    Try giving <link rel="stylesheet" href="./test.css" type="text/css" /> see the "./" or even test with the absolute path and see what is going wrong and step down to the actual path that is relative to the page requesting css.
     
  3. Rakish

    Rakish New Member

    Joined:
    Jun 30, 2006
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    0
    thanks Shabbir,

    I got a reply from another forum and now it works for me,

    what you gotta do is to provide the url instead of a path (absolute or relative - both didnt work for me)

    below is the code:

    if the css file is in the /var/www/html folder and the css file is style.css

    the code will look like:

    hope it helps others

    Rakesh Gupta
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
    Thats the way to specify the absolute URL but for relative one you can use "./" and "../" to achieve the same. You can check the source code of the current page and you will see the relative css is linked.
     

Share This Page