beautypg.com

Defining dynamic templates – Adobe Extending Dreamweaver CS4 User Manual

Page 24

background image

18

EXTENDING DREAMWEAVER CS4

Customizing Dreamweaver

Defining dynamic templates

You can create templates that are based on dynamic document types. These templates are called dynamic templates.
The following two elements are essential to defining a dynamic template:

The value of the

internaltype

attribute for the new document type must be

DWTemplate

.

The

dynamicid

attribute must be set, and the value must be a reference to the identifier of an existing dynamic

document type.

The following example defines a dynamic document type:

id="PHP_MySQL"
servermodel="PHP MySQL"
internaltype="Dynamic"
winfileextension="php,php3"
macfileextension="php,php3"
file="Default.php">
PHP

Now, you can define the following dynamic template, which is based on this

PHP_MySQL

dynamic document type:

id="DWTemplate_PHP"
internaltype="DWTemplate"
dynamicid="PHP_MySQL"
winfileextension="php.dwt"
macfileextension="php.dwt"
file="Default.php.dwt">
PHP Template

When a Dreamweaver user creates a new blank template of type DWTemplate_PHP, Dreamweaver lets the user create
PHP server behaviors in the file. Furthermore, when the user creates instances of the new template, the user can create
PHP server behaviors in the instance.

In the previous example, when the user saves the template, Dreamweaver automatically adds a .php.dwt extension to
the file. When the user saves an instance of the template, Dreamweaver adds the .php extension to the file.

Adding and modifying document extensions and file types

By default, Dreamweaver shows all the file types it recognizes in the File > Open dialog box. After creating a document
type, extension developers must update the appropriate Extensions.txt file. At times, the user maybe on a multiuser
system (such as Windows XP, Windows Vista, or Mac OS X). In such cases, another Extensions.txt file exists in the
user Configuration folder. The user must update the Extensions.txt file because it is the instance that Dreamweaver
looks for and parses.

The location of the Configuration folder of the user depends on the platform of the user.

Windows XP platform uses the following location:

hard disk:\Documents and Settings\username\Application Data\Adobe\Dreamweaver CS4\Configuration

Note: It is possible that this folder is inside a hidden folder.

Windows Vista platform uses the following location:

This manual is related to the following products: