Forums

This topic is locked

relative links in templates

Posted 22 years ago
1
has voted
22 years ago Amber Neill posted:
All,
I have a problem I hope you can help me with.
I have a template with a menu of links down the left side. Pretty standard. When I apply the template to files within my site (some of which aren’t in the same folders), the links don’t always work.
For example, I have two files A.htm and B.htm and A.htm is one level up the directory tree from B.htm. If I apply the template to both of them, the links might work on A.htm but not on B.htm because of their relative location in the tree.
Is this a feature?!? Or am I doing something wrong? I have tried to move my files to one folder thinking this might help. Other than making my directory hard to navigate and files hard to find, it didn’t help my link problem.
Can anyone help me fix my site!?!?
Thanks in advance,
Amber

Replies

Replied 22 years ago
22 years ago Iain Stewart replied:
Hi there,

I had the same problem a while back. The only way round it was to put all my html files, including the template file in the root directory and image, downloads and so one in other directories, this way all the links on the template worked.

What you might want to think about is server side includes files, i use these instead of templates, you just create a basic page insert the server side includes file which contain the code for header footer images nav bars etc, seperate file for each and it works great.

One benefit is if you update a template you have to upload every file that uses the template, however update an include file and you only have to upload that one file and all the changes are made on every page the includes the file, save lots of time.

hope this helps.

Iain

head hurts, 'mental note to self, stop banging head !'
Replied 22 years ago
22 years ago Jeremy Conn replied:
I agree... I have found server-side includes to be much more versatile and powerful than the templates, especially when dealing with menus.

(DWMX|IIS5|Access2K|XP|ASP/VB)
*Connman21*
www.conncreativemedia.com
Replied 22 years ago
22 years ago Amber Neill replied:
All,
Server side includes intrigue me, but being a bit of a newbie and not having any control over the server (it is hosted in a land far, far away), I hesitate to go that route.
It never occured to me that templates might have trouble with relative links. Is this on purpose? Can anyone enlighten me as to why this might be desirable? Just curious.
Thanks,
Amber
Replied 22 years ago
22 years ago Marja Ribbers-de Vroed replied:
When you need to make a change to a template, all derived 'child' pages need to be uploaded to your server again.

In the case of server-side includes, you would just make the change in the SSI file and upload that one file to the server again. And all pages using the SSI file are automatically using the most recent information.

But be aware of relative paths here as well.
I think it's best to use root relative paths in the SSI files themselves.

Hope this helps.

--
Marja Ribbers-de Vroed
www.flevooware.nl
www.flevooware.nl/dreamweaver/


Edited by - MarjaR on 19 Feb 2003 21:34:07
Replied 22 years ago
22 years ago Iain Stewart replied:
Hi,

Server Side includes are just files that you write and upload with your html files. You don't need any control on the server to use them, just check with your host to see if they support them and what file extension they need to be, mine need to be .shtml files for them to work.

Also make sure you are using asp or php files as ssi won't work wih standard html files.

What you do is write the info you want to be on many pages, say a footer, like copyright webmaster email etc and remove all the standard html tags like html head title body and just leave the text and formating tags,save as a seperate file, like footer.shtml
Then go to the page you want this info included on and select insert - script object - server side includes and the info will appear on the page.

play about with them, you never use templates again.


Iain

head hurts, 'mental note to self, stop banging head !'

Reply to this topic