# Thread: Perl template with css integration

1. ## Perl template with css integration

I am trying bit hard to use style sheet elements in .tpl page in perl script.

2. keep in mind that the link to the style sheet is relative to the folder the .tpl file is being displayed from. If your script that opens and displays the tpl file is in the cgi-bin the style sheet would also have to be in the cgi-bin, and that would most likely not work since the cgi-bin usually only serves up scripts to the www and not other documents. If you never know where the tpl file will be displayed from, use an absolute URL (not a file path but a url starting with http://www.yourdomain.com/ ) to the css file, which is slow since a DNS lookup and all that garbage has to be done. But if you do know, place the style sheet in a folder just above the cgi-bin (or where ever appropriate) and use a realtive path to the css file: link="style/style.css" and hopefully that will work. Where "style" is the name of the folder the style.css file is stored in.

3. Originally Posted by KevinR
keep in mind that the link to the style sheet is relative to the folder the .tpl file is being displayed from. If your script that opens and displays the tpl file is in the cgi-bin the style sheet would also have to be in the cgi-bin, and that would most likely not work since the cgi-bin usually only serves up scripts to the www and not other documents. If you never know where the tpl file will be displayed from, use an absolute URL (not a file path but a url starting with http://www.yourdomain.com/ ) to the css file, which is slow since a DNS lookup and all that garbage has to be done. But if you do know, place the style sheet in a folder just above the cgi-bin (or where ever appropriate) and use a realtive path to the css file: link="style/style.css" and hopefully that will work. Where "style" is the name of the folder the style.css file is stored in.
let me substantiate the contents' placements:

The file that is executing is in the folder
\\win2ksrv\c$\Program Files\Apache Software Foundation\Apache2.2\cgi-bin\times\times.pl and this is calling the template means the .tpl file which is located in \\win2ksrv\c$\Program Files\Apache Software Foundation\Apache2.2\cgi-bin\times\templates\start.tpl, start.tpl file is containing the css file, now you make clear where I should place the css file.

4. If your templates are in cgi-bin\times\templates then put the times.css css file in the same folder and reference it as <link href="times.css" rel="stylesheet" type="text/css" />

5. Originally Posted by bluedreamer
If your templates are in cgi-bin\times\templates then put the times.css css file in the same folder and reference it as <link href="times.css" rel="stylesheet" type="text/css" />
Won't work unless the cgi-bin is setup in a manner to allow www read access to non-script files.

6. \\win2ksrv\c\$\Program Files\Apache Software Foundation\Apache2.2\cgi-bin\times\times.pl

What is the URL to the website? Is it localhost? How do you access the above from a web browswer?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•