Setting Up Custom Pages


You can use two approaches to set up custom pages ”one using Dreamweaver templates and the other using document types. The first method is the easiest to implement; it can be used both for standard templates in which certain areas of the page are locked and for fully editable pages, which include custom <meta> tags or comments. Following is the procedure for setting up custom pages by using a Dreamweaver template:

  1. The administrator saves a blank, customized page as a Dreamweaver template in a particular site.

    If the page is to be completely editable, you don't need to add editable regions. Dreamweaver displays an alert noting the lack of such regions when the file is saved; in this instance, it is safe to ignore the alert.

  2. To make a new page from the template, the designer makes a new page by choosing File > New and selecting the custom template from the Template tab.

  3. For the page to be totally editable and free of template markup, clear the Update Page When Template Changes check box.

Although this technique is workable , it is less than ideal. The designer must remember where the template is located; templates are site specific, and it would be burdensome for the administrator to establish the custom page in every site on an ongoing basis. Moreover, the designer must keep an eye on the Update Page When Template Changes check box, especially if he is creating both standard templates and detached templates. This technique is perhaps best used for projects that are restricted to a small number of sites.

TIP

If a standard template is created by mistake, choose Modify > Templates > Detach from Template.


The second method of creating a new custom base page is more involved, but it's an overall pervasive solution. Although it might not be obvious, the list of documents shown in the New Document dialog box is extensible. You can add both static and dynamic custom pages ”in regular or template format ” to the dialog box. After these pages are integrated into Dreamweaver, the designer just chooses the custom document type from the list.

For a complete integration of a new document type, several areas must be addressed:

  • A new document type XML file should be added to the Configuration folder.

  • A prototype of the document should be saved in the New Documents folder.

  • The documents extension(s) should be added to the Extensions.txt file.

  • An editor for the document type should be assigned either on the system level or within Dreamweaver.

Adding a New Document Type

Several files found in Dreamweaver's Configuration/DocumentTypes folder control what appears in the New Document dialog box. The MMDocumentTypes.xml file describes the standard Dreamweaver documents shown in the dialog box. Although it's possible to customize this document, you shouldn't. Custom document types are best added by including a separate XML file following the same syntax as MMDocumentTypes.xml in the DocumentTypes folder.

The MMDocumentTypes.xml file consists of a series of <documenttype> tags, one for each kind of file. Here, for example, is the entry for a basic HTML page:

 <documenttype id="HTML" internaltype="HTML" winfileextension=  "htm,html,shtml,shtm,stm,lasso,xhtml" macfileextension=  "html,htm,shtml,shtm,lasso,xhtml" file="Default.html">     <title>        <MMString:loadString id="mmdocumenttypes_0" />     </title>     <description>        <MMString:loadString id="mmdocumenttypes_1" />     </description>  </documenttype> 

The attributes within the <documenttype> tag define how the entry will appear within the New Document dialog box:

  • id ” A unique identifier for the document type. If two or more document types have the same ID, the first one defined is used.

  • internaltype ” Determines what modes are available in Dreamweaver for the given document type. Valid values are HTML , HTML4 , XHTML1 , XML , Dynamic , DWTemplate , and DWExtension .

  • dynamicid ” If DWTemplate is declared as the internalType and the desired page is data driven, the dynamicid attribute must be defined. Accepted values for dynamicid correspond to the supported server models: ASP.NET C# , ASP.NET VB , ASP VBScript , ASP JavaScript , ColdFusion , JSP , and PHP MySQL (optional).

  • winfileextension ” The file extensions, given in a comma-separated list, for the Windows platform. Dreamweaver automatically saves new files of the document type using the first extension in the list.

  • macfileextension ” The file extensions, given in a comma-separated list, for the Macintosh platform.

  • file ” The file used as the prototype for the document type. By convention, the file is named Default. fileExtension , where fileExtension is the first entry in the winfileextension or macfileextension attributes, such as Default.jwl . All prototype files are stored in the Configuration/DocumentTypes/ NewDocuments folder.

  • servermodel ” Used only in the case of dynamic document types, this attribute specifies which server model is to be used. The acceptable values are ASP.NET C# , ASP.NET VB , ASP VBScript , ASP JavaScript , ColdFusion , JSP , and PHP MySQL . If custom server models are developed, their names as noted in the implementation files can be used (optional).

  • previewfile ” The path to the file shown in the Preview area of the New Documents dialog box (optional).

Two tags are within the <documenttype> tag: <title> and <description> . Both contain text strings (or references to text strings) that are used in the New Documents dialog box display. The content in the <title> tag displays in the category-specific list, whereas the <description> appears in the Description area (see Figure 1.1).

Figure 1.1. Information defined in the Document Type XML file is shown in the New Document dialog box.

graphics/01fig01.gif

Macromedia uses references to text entries within an external file (Configuration/Strings/documenttypes.xml) for localization purposes:

 <title>     <MMString:loadString id="mmdocumenttypes_0" />  </title>  <description>     <MMString:loadString id="mmdocumenttypes_1" />  </description> 

Custom document types can use plain text, like this:

 <TITLE>     JWL  </TITLE>  <description>     JWL Document  </description> 

As noted earlier, it's a better idea to define any custom document types in a separate XML file rather than to modify MMDocumentTypes.xml. To be most effective, the custom document type should be implemented at the administrator, not individual, user level. In that situation, if a new version of Dreamweaver were installed, any modified version of MMDocumentTypes.xml would be replaced . Moreover, there is no real need to alter the original file; Dreamweaver automatically reads any XML file stored in the DocumentTypes folder, incorporating the additions into the New Document dialog box.

The custom XML file must follow the structure of the MMDocumentTypes.xml file with an opening XML declaration identifying the Macromedia XML namespace, followed by a <documenttypes> tag, which encloses one or more <documenttype> tags:

graphics/01icon01.gif

graphics/01icon02.gif

Storing the Prototype

The page prototype ”which could be either a static page or a Dreamweaver template ”should include everything to be repeated in every file. Both code in the <head> (such as <meta> tags or other custom tags necessary to work with the CMS) and common elements in the <body> (such as a copyright line) should be included. When completed, save the file in the Configuration\DocumentTypes\NewDocuments folder. Although you're under no obligation to comply , the convention is to name the file Default combined with the needed file extension ( Default.jwl) .

Integrating the Document Extensions

The initial two steps ”creating the document type XML file and storing the prototype ”took care of making a new custom document. To open that document easily in Dreamweaver for editing, you need to perform two more steps. The first step allows custom extensions to appear in any of the Open or Select dialog boxes. To accomplish this, you need to modify the Extensions.txt file. This file is located in the root of the Configuration folder and can be edited directly in Dreamweaver.

When you open the Extension.txt file, you'll see a number of entries like this:

 HTM,HTML,HTA,HTC:HTML Documents  SHTM,SHTML,STM,SSI,INC:Server-Side Includes  JS:JavaScript Documents 

Custom entries follow this format of extensions: description . For example, if I wanted to insert an entry for the JWL documents that use the .jwl extension, I would include this line:

 JWL:JWL Documents 

The order of entries in the file is the same as the order in the dialog box. You can insert custom entries anywhere in the list.

Assigning the Editor

The final step to integrate a custom CMS file type into the Dreamweaver workflow is to make sure the file type is editable by Dreamweaver. You can accomplish this in two ways:

  • Through the operating system. In Windows, this is done through the File Types tab of the Settings, Control Panels, Folder Options dialog box. On Macs, the best system I've found uses a freeware application called FileType. It's available at http://www.frederikseiffert.de/filetype/, and it works on both OS 9 and X.

  • In Dreamweaver, add an Extension entry to the Files / Editor category of Preferences (see Figure 1.2). With the newly added extension selected, choose the Add button above the Editors list and navigate to the Dreamweaver executable.

    Figure 1.2. Make Dreamweaver the primary editor for your custom file types through Preferences.

    graphics/01fig02.gif

After you have completed either of these chores, double-click on any document with the custom extension in the Site panel to open that file in Dreamweaver for editing.

TIP

One file type can have more than one editor. Be sure to make Dreamweaver the primary editor if you want to be able to double-click on the file to open it. Otherwise, to open a custom file in the Site panel, right-click on the filename and choose Open With > Dreamweaver.




Joseph Lowery's Beyond Dreamweaver
Joseph Lowerys Beyond Dreamweaver
ISBN: B000H2MWYS
EAN: N/A
Year: 2001
Pages: 87
Authors: Joseph Lowery

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net