Gossamer Forum
Quote Reply
Dynamic Paths
hi. i am using v2.0, with the templates, not site_html.pl. i have images and SSI calls in the templates. they are correctly 'pathed' to those files. when i build the pages, the paths are not altered, so i get a lot of broken links.

how can i make the scripts alter the paths from the templates? i cannot use a full path name (the full URL) practically on every template.

------------------
Theoretic Internet Services (http://www.theoretic.com)
'Your Web Hosting, Button Exchange, and Weather Forecasts Solution, with Just Two Words: Quality and Privacy'
Quote Reply
Re: Dynamic Paths In reply to
Let's assume that your images directory (for example) is one subdirectory below your web (or document) root directory. To display the images without worrying about broken image graphics or what directory depth the html page is in, use something like this:

Quote:
<img src="/images/filename.gif">

Note the leading "/". This tells the server to find the images directory by looking for it in the root directory. If the images directory was two levels deep, it might look like this:

Quote:
<img src="/links/images/filename.gif">

Again, this tells the server to look for the images directory by first looking for the "links" directory in the root, and the "images" directory in the "links" directory.

Using this form, you need not worry where the html page is located; it will always work.

I hope this helps.

[This message has been edited by Bobsie (edited June 10, 1999).]
Quote Reply
Re: Dynamic Paths In reply to
you mean the server's root, right? not the Links 2.0 pages root? okay, tried the first, with my path of:
/opt2/home3/theoretic/public_html/htmlbin/nav_panel.txt

(it's an SSI call)

but still getting the error that the server can't include that file into the parsed page. i'm going to try and run some more tests and tries on it, though.

------------------
Theoretic Internet Services (http://www.theoretic.com)
'Your Web Hosting, Button Exchange, and Weather Forecasts Solution, with Just Two Words: Quality and Privacy'
Quote Reply
Re: Dynamic Paths In reply to
One of the problems with installing scripts is to understand "where" you are. Sometimes it's not easy, but there are some simple things to consider.

If the SERVER (software program) is asked to find the image, ie: via a <img src=..> or <A HREF ...> set of tags, the path needs to be a _URL_ relative to the SERVER (software program) root, or to the current directory. You are much less likely to have errors if you set the path relative to the server root -- start at the top and work down. The server only knows where it lives, ie: the "document root", nothing else about your system.

Perl, on the other hand, only knows where it lives. You have to tell it the full paths (or relative paths) to the file, from the top of the DISK down (the PHYSICAL (machine server) not the software server root).

If the Perl script is looking for the file, such as a log path, or include files, it has to be relative to the SYSTEM (physical server) path, since your operating system, NOT the server (software), is calling the shots at this time. It doesn't know where the server lives, which is why you must enter the "document root" and other paths, as well as the "URL root" to a script's configuration.

Hope that helps a little Smile Remember, when you generate an HTML page, the image tags, have to point to a URL, *NOT* a disk path. Those tags are instructions TO THE SERVER to go fetch the image. The _server_ can't find anything that is not in it's document tree.

The Perl script, on the other hand, can find anything.... which is why file permissions are so important.

I tried to explain Smile But terminology is so hard ... one day it will all just suddenly "make sense" <G> Just keep in mind who is really doing the asking -- Perl or the Server.

Scott


Quote Reply
Re: Dynamic Paths In reply to
No, I didn't mean the server root, I meant the document root which is the base web directory which, in your case, is the public_html directory. The examples I gave were for your images directory but the same concept will work for SSI (running other cgi scripts) by using "/cgi-bin" (or what ever name your cgi directory has) with the leading slash.

The leading slash will eliminate the hassle with trying to figure out "where you are" when bringing up images or using SSI to call other scripts.

I hope this helps.
Quote Reply
Re: Dynamic Paths In reply to
yes! it's working! i figured it out, with the great help of bobsie & pugdog Smile

i understood finally what you meany by web root, and got it working Smile now just one last problem, but that will be in a new thread, since it is not about dynamic paths.

------------------
Theoretic Internet Services (http://www.theoretic.com)
'Your Web Hosting, Button Exchange, and Weather Forecasts Solution, with Just Two Words: Quality and Privacy'