User Guide
48 Chapter 2: Extending Dreamweaver
When Dreamweaver starts, it reads all document type definition files and builds a list of valid
document types. Dreamweaver treats any entries within the definition files that have nonexistent
server models as nonserver model document types. Dreamweaver ignores entries that have bad
contents or IDs that are not unique.
If, while scanning the Configuration/DocumentTypes folder, Dreamweaver finds no document
type definition files or if any of the definition files appear to be corrupt, Dreamweaver closes with
an error message.
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:
<documenttype
id="PHP_MySQL"
servermodel="PHP MySQL"
internaltype="Dynamic"
winfileextension="php,php3"
macfileextension="php,php3"
file="Default.php">
<title>PHP</title>
<description><![CDATA[PHP document]]></description>
</documenttype>
Now, you can define the following dynamic template, which is based on this PHP_MySQL dynamic
document type:
<documenttype
id="DWTemplate_PHP"
internaltype="DWTemplate"
dynamicid="PHP_MySQL"
winfileextension="php.dwt"
macfileextension="php.dwt"
file="Default.php.dwt">
<title>PHP Template</title>
<description><![CDATA[Dreamweaver PHP Template document]]></description>
</documenttype>
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.