Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Perl (http://www.go4expert.com/forums/perl/)
-   -   Unable to link css file when using HTML::Template (http://www.go4expert.com/forums/unable-link-css-file-using-htmltemplate-t1137/)

Rakish 7Aug2006 20:40

Unable to link css file when using HTML::Template
 
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:

Quote:

<html>

<head>

<title>CssCreator-->HTML 4.01 Strict Template</title>

<meta http-equiv="content-type" content="text.tmpl;charset=utf-8" />

<meta name="generator" content="www.csscreator.com" />

<link rel="stylesheet" href="test.css" type="text/css" />

It doesnt work,

but if i embed the same CSS code in the:


Quote:

<head>

<style>
css code
</style>

</head>
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

shabbir 7Aug2006 21:24

Re: Unable to link css file when using HTML::Template
 
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.

Rakish 7Aug2006 22:23

Re: Unable to link css file when using HTML::Template
 
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:

Quote:

<link rel="stylesheet" href="http://server/[path to the css file]" type="text/css" />
if the css file is in the /var/www/html folder and the css file is style.css

the code will look like:

Quote:

<link rel="stylesheet" href="http://server/style.css" type="text/css" />
hope it helps others

Rakesh Gupta

shabbir 8Aug2006 04:50

Re: Unable to link css file when using HTML::Template
 
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.


All times are GMT +5.5. The time now is 17:09.