1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Unable to link css file when using HTML::Template

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

  1. Rakish

    Rakish New Member

    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

    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

    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

    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