473,414 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Paths question

I am having a problem with programming in perl using paths to style sheets
and other static pages. I need a little clarification

My scenario

root directory | - /var/www
html directory | - /html FULL PATH - /var/www/html
images dir | - /images -
/var/www/html/images
cgi-bin dir | - /cgi-bin -
/var/www/cgi-bin
perl scripts dir | -/perl -
/var/www/cgi-bin/perl

The PERL directory holds programs that create pages on the fly by reading
both dynamic data and snippets of the final html page. The page is assembled
by reading a snippet file and then inserting dynamic data and reading
another snippet. I PRINT the snippet to Standard Out which is the web page
itself.

My CSS page is stored in my /var/www/html directory. In my HTML text stored
in the /var/www/cgi-bin/perl, I use the statement:

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

Since normally everything is relative to the base directory "/var/www" I
would think that it should work but it does not.
If I use the full path it cant find the file
"/var/www/var/www/html/base.css" Which shows that it append the full path
name to the base directory.

How can I programmatically specify the path to my CSS sheets and for that
matter my images when I use them?

Thanks in advance
Jul 19 '05 #1
5 1666
Jim Rendant wrote:
I am having a problem with programming in perl using paths to style
sheets and other static pages. I need a little clarification
<snip>
<link href="html/base.css" rel="stylesheet" type="text/css">

--------------^^^^^^^^^^^^^
That shall be a URL, not a path on your file system. I would guess
"/base.css" or whatever you would type in the location bar of your
browser in order to read the style sheet.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Jul 19 '05 #2
m
Jim Rendant wrote:
<link href="html/base.css" rel="stylesheet" type="text/css">


The problem may be that you're missing the correct address of
the link, but maybe not:

<link...> in generated pages doesn't always result in the link
being loaded into the page by the browser. Try sucking the CSS file
into a variable and writing it into the <head> of the HTML file between
<style> tags.
HTH
m
http://www.mbstevens.com/

Jul 19 '05 #3
m wrote:
<link...> in generated pages doesn't always result in the link
being loaded into the page by the browser.


That has never happened to me. Can you give us an example that
illustrates what you are saying?

Of course, the CSS file must be located in a directory that is
readable from the web. If it's not, it won't be loaded, but that would
be the case both with a generated and a static page.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Jul 19 '05 #4
m
Gunnar Hjalmarsson wrote:
m wrote:
<link...> in generated pages doesn't always result in the link
being loaded into the page by the browser.

That has never happened to me. Can you give us an example that
illustrates what you are saying?

Of course, the CSS file must be located in a directory that is readable
from the web. If it's not, it won't be loaded, but that would be the
case both with a generated and a static page.


Thanks for spurring me on to further testing of this, Gunnar.
After running some tests over the past hour or so, I believe you
are right. Don't know what I was doing wrong in my other programs,
perhaps forgot to set the base address. At any rate, this promises to
simplify a couple of my programs considerably.

Cheers,
m

Jul 19 '05 #5
m wrote:
this promises to simplify a couple of my programs considerably.


Glad to be able to help. :)

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: JStrummer | last post by:
I have a question regarding paths and the include() statement in PHP. I develop in a Windows environment and will be publishing to a Linux server. I would like to do the following: 1. Setup my...
5
by: Bill Davis | last post by:
I am just starting to play with CGI programs on a box with RH 9. Testing to see if I had the stuff installed I used a very simple script like so... #!/usr/bin/perl -w use strict; use CGI; ...
7
by: Travis Pupkin | last post by:
Hi, Just curious: is there a bit of ASP code you can place in the top of a document that will force all root relative image and file paths in the HTML of this doc to expand to include the full...
24
by: Lovely Angel | last post by:
Dear Friends Hope you doing great. I have recently shifted to a webhost which is Using Windows 2003 and IIS 6. Now my application was working fine earlier but now I am facing this problem ...
11
by: BoonHead, The Lost Philosopher | last post by:
I think the .NET framework is great! It's nice, clean and logical; in contradiction to the old Microsoft. It only saddens me that the new Microsoft still doesn't under stand there own...
3
by: Chris Kilmer | last post by:
I would like to be able to customize the path structure that VS.NET 2003 creates for projects. 1. I'd like to be able to create a project without VS.NET creating a folder for that project. ...
4
by: Chad Richardson | last post by:
As I'm writing this I think I am answering my own question, but I'd like to get any other ideas on the subject as well. I have a standard Header.asp that I want to include in every other page in...
2
by: Mike | last post by:
Can a vb program running as a serice not use network paths to do file/io? I can't seem to get my program to work with network paths and files. When I use local disk it works fine. When I run it...
5
by: costantinos | last post by:
Hello. I have implemented the Dijkstra shortest path algorithm, it works fine but I have one question on how I can improve something. I want to find all the possible shortest paths from a node...
15
by: Lars Eighner | last post by:
Aside from the deaths of a few extra electrons to spell out the whole root relative path, is there any down side? It seems to me that theoretically it shouldn't make any difference, and it would...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.