Using the Default Documents to Speed Up Your Work Flow

By: Adrian Senior

Page 1 of 2

Set for printing

Next

Danilo Celic made an excellent and free extension some time back for Community MX. It allows you to edit, and thereby enhance, the default documents that Dreamweaver uses to create a new page at your request. The extension is called "Edit document templates". I got to wondering how many folks are using this extension as it really is a valuable tool that makes access to the default templates quick and painless. Once the extension is installed, you can easily edit/modify your default templates to suit how you work, and in turn boost your work flow starting point.

The default documents are used by Dreamweaver to create a new page, typically from the File menu or the Ctrl + N keyboard shortcut. This article does not refer to Dreamweaver's design templates, though any changes made to the New Document Templates for Dreamweaver's design templates would also be shown in new design template pages and child pages of those templates.

Installing the Extension

Download the "Edit Document Templates" from the CMX site and follow the documentation for installing the extension. Once you have installed the extension close and then re-open Dreamweaver. When that is completed, you will be ready to follow along with this article.

The Dreamweaver default.cfm Template

I'm going to talk about the default.cfm template. As its name suggests, this is the template Dreamweaver uses for creating new ColdFusion pages. The page is unimportant. It could just as easily be default.jsp or any of the other default templates that Dreamweaver uses to generate a new page.

Now that you have installed the extension you can access it from the Edit menu. Selecting it will open the "New Document Editor" window. Select the document you want to work on and click the Edit button. It is never a bad idea to do a Save as on this file and save it to a safe location as a back-up. Once you have done that, repeat the process to open the New Document Template of your choice once again. With a back-up in place you can safely edit your New Document Template without any worries.


Image 1: The New Document Editor window

The code within the New Document Template:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"""http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=">
<TITLE>Untitled Document</TITLE>
</HEAD>

<BODY>

</BODY>
</HTML>

Listing 1: The code supplied in the default.cfm New Document Template

The code you see when you open your New Document Template will vary from language to language, so don't worry if yours looks a little different to Listing 1.

Improving on the New Document Template

The fact that we have access to and can edit these templates provides us with an opportunity to enhance code within the document and to build on it by adding any code that you would consider to be default code for your workflow. Let's begin at the top of the document and start with the doc type. My default doc type choice is an XHTML transitional one and this is the first thing I will be changing.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>

Listing 2: Changing the doc type

All new documents have a HTML 4.01 loose doc type by default. If your preferences say XHTML transitional, or if you select a different option from the New Document window, then the default doc type is over written by your preferences or document choice. So, why change the New Document Template? Dreamweaver's doc types are missing an important piece of accessibility information, the language declaration for the document.

xml:lang="en" lang="en"

By changing the doc type in the New Document Template we can have the language type included in each new page by default.

Page 1 of 2 1 2 Next


download
Download Support Files


Downloads are disabled during your trial period.


Keywords
New, Document, Templates, Work, Flow, XHTML, CFM, HTML, time saving