You're welcome!
See below -
--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================
"gwalt" <webforumsuser (AT) macromedia (DOT) com> wrote
Quote:
Thanks a bunch. I'll give it a try. I'm still a bit confused on two
issues
though:
1. Can you explain the "root relative links" issue in more detail? When
to
use vs. when not to use. I noticed that your path did not start with the
".../" beginning. Is there a reason for this? |
Yes - it's a root relative link.
Paths that start with nothing, e.g., <a href="foo.html", or that start with
a reference to the parent folder, e.g., <a href="../foo.html", are document
relative. This means that they describe how to get from the currect
document (wherever it is in the folder hierarchy) to the target document
(wherever it is in the folder hierarchy).
Paths that start with a slash are root relative, e.g., <img
src="/images/foo.gif". This means that they describe how to get from the
root of the site to the target file, no matter where the current page is
located. In this case the root of the site is the reference point, not the
location of the current document.
The use of root relative links means that the link will work (without
maintenance) in any document, in any location in your site.
The use of document relative links means that if the current document is
moved to a new location, the link needs to be adjusted accordingly.
Luckily, DW does this for you automatically on links it can recognize. But
links such as you have, or links embedded in javascript code (as are all the
links in the DW/FW pop-up menus) cannot be recognized by DW, and hence
cannot be maintained. The solution is to not use a link type that needs
this maintenance, i.e., use a root relative link.
So why not use root relative links all the time? Well, you could do this.
They work well, EXCEPT if you are not using temp files to preview in DW,
none of your externally linked files will load when you preview, and none or
your links will work when you preview. Why? Because when the file is
handed to the browser by DW, the browser sees the leading slash and
interprets that as the root of the hard drive, not the root of the site (the
browser doesn't have a clue where the site is). If you ARE using Temp files
to preview (EDIT | Preferences > Preview in Browser), the DW magically
changes all root relative links to document relative links before handing
the file to the browser, so everything works as intended. It does this
because it creates the temp file which is what the browser shows you.
Quote:
2. So how does the template affect my "non root relative links" if they
are
stored in my database. And why are the links only impacted when I update
and
save the template file? |
The Template is in the Templates folder, which must be in the root level of
the site. Nothing else should be in the Templates folder. This means that
EVERY link to every file in the template page should look like this -
<a href="../
In other words, it is impossible to get to any other file from the Template
file, without going up one folder level.
Now - when you spawn a child page, and save it in some other location, all
links are adjusted to work from that other location. All links that DW can
*find*, that is. If DW can't find your link, it can't adjust it. And
what's the solution for that? (all together now) ROOT RELATIVE LINKS!
OK - if you store the path to the images in the data field along with the
image filename, and create your links using this information, e.g.,
<img src="<% yourfieldvalue %>"
then you have created a link that a) DW cannot maintain, and b) that is not
ideal for you from a maintenance point of view. Why? Imagine that two
weeks from now, you decide for compelling reasons to move all your image
files to another location within your site. Oops. Now, every image path in
every record in your database has to be adjusted. If, however, you had
created your link like this -
<img src="path/<% filename %>"
then you have only to adjust the single line (or lines) to reflect the new
path.
Geddit?