Document relative paths pointing to items located in the Templates folders are rewritten in new pages created from templates
Issue
Some developers using Macromedia Dreamweaver have become accustomed to using the Templates folder to store files that are not template (DWT) files. In previous versions of Dreamweaver, paths to these files would not be updated in a page based on a template. When using Dreamweaver 8, however, document relative paths pointing to items located in the Templates folders are rewritten in new pages created from templates.
This change in behavior is noticeable if the files in the templates folder are server-side include files, CSS files, links or images. In Dreamweaver 8, new pages created from templates with these types of document relative paths have the Templates folder added to the path. For example, the following code in the parent template file (DWT file):
<!--#include -->
is rewritten to the following path when a new child page is created from the template:
<!--#include -->
Note: Macromedia does not recommend placing any non-template files in the Templates folder. See the Using Dreamweaver LiveDocs for more information. (Ref. 192209)
Reason
When creating a new child page from a template, Dreamweaver MX 2004 and Dreamweaver MX would not rewrite document relative paths that pointed to non-template items located in the Templates folder. This was inconsistent, because when creating a new child page from a template, Dreamweaver would rewrite the document relative paths that pointed to non-template items located in any other folder besides the Templates folder. Due to complaints from some Dreamweaver MX 2004 and Dreamweaver MX users regarding this inconsistency, Dreamweaver 8 was changed so that it treats document relative paths pointing to non-template items in the Templates folder just like it treats document relative paths pointing to non-template items in any other folder, when creating child pages from the templates. So, Dreamweaver 8 rewrites all document relative paths when creating a new child page from a template, regardless of whether or not the item being linked to was in the Templates folder or not.
Solution
Afterthe Dreamweaver 8.0.1 Updateris installed, Dreamweaver's default behavior is to leave document relative paths alone that point to items located inside the Templates folder. If you prefer to have Dreamweaver 8.0.1 treat document relative paths that point to items located inside the Templates folder as it would any other path and re-write them, go into the Site Definition dialog box and uncheck the "Don't rewrite document relative paths." Once this option is unchecked, Dreamweaver will add the Templates folder to the path, which was the default behavior and only option in Dreamweaver 8.0. See the following TechNote for more information: Understanding the Template Updating option in Dreamweaver 8.0.1 (TechNote f55d8739).
If you cannot install the Dreamweaver 8.0.1 Updater for some reason and you want Dreamweaver 8 to leave your document relative paths alone that point inside the Templates folder, an alternative workaround is to use template expressions by wrapping the file name with @@('')@@. Here are some code syntax examples for include files, CSS files, images and links:
- PHP include:
<?php include("@@('include.inc')@@"); ?> - ColdFusion include:
<cfinclude template="@@('include.inc')@@"> - JSP include:
<%@include %> - ASP & ASP.NET include:
<!--#include@@('')@@ --> - CSS file:
<link href="@@('styles.css')@@" type="text/css" /> - CSS file:
@import url("@@('styles.css')@@"); - Image:
<img href="@@('image.gif')@@" /> - Link:
<a href="@@('link.htm')@@">link text</a>
Note: include.inc, styles.css, image.gif and link.htm are the real file paths, not template parameters, so they have to be wrapped with single quotes.
This content requires Flash
To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.
Download the free Flash Player now!
