Web Hosting Talk







View Full Version : Wondering if a script or code like this exists..


chillami
11-16-2004, 10:58 PM
Hi!

First of all, I don't know how to do any programming but it seems like there is an answer for just about everything so I thought I'd ask :-)

You know how if you put an inclusion on a site, it automatically looks for the inclusion file in the home directory? Is there something like this that can be added on a page/site that tells the server that whenever it has an image to load, it knows to go into the main directory into an images or images2 folder? This way you don't have to do the .../.../images/filename,jpg thing and it's less likely image links would be referenced wrong.

Seems like a good idea so I was wondering if someone has already created something like this :-)

Chris

Salathe
11-16-2004, 11:12 PM
You can references directly from the web root by starting with a forward slash:
<img src="/images/filename.jpg">

Not what you're looking for?..

chillami
11-16-2004, 11:20 PM
So, even if the shtml pages are buried like 5 directories down (which would be extreme, I know) if I referenced the images this way, they would automatically go to the root dir? Will this work on my harddrive as well when I am editing with Dreamweaver?

Burhan
11-17-2004, 03:16 AM
Aother way to do this is to add the base href tag. This will append a URL to any links that are relative.

So, with this tag :

<base href="http://www.domain.com/images/">

this tag <img src="foo.jpg">

automatically becomes <img src="http://www.domain.com/images/foo.jpg">

BigHostCompany
11-19-2004, 02:23 AM
I would go with the base href tag :)

ArcaneChaos
11-19-2004, 07:49 AM
i thought base tags were one of the first things you learned in those book thingys ? :/ oh well. yeah, base tag it and bag it. and stuff.