How to set file behavior in Dreamweaver MX for custom file types

Dreamweaver MX can support just about any file type if you tell it to. Dreamweaver looks at a filename’s suffix to know how it should be treated, and this behavior can be customized rather easily. Natively, it supports all the standard server types such as .jsp, .php, .xml, .html, .cfm, and – god forbid – .asp, as well as a host of others.

But lets say your site use some lesser known application server, or you’ve edited your httpd.conf file to trick Apache into using your company’s ticker symbol as the default file extension. Or for whatever reason, you have pages that don’t have any of the common and traditional file name extensions and when you try to open the file in Dreamweaver MX, the thing appears as code, or worse, opens up in another application.

It doesn’t have to be this way.

To add your custom extensions, and to have Dreamweaver treat it the way you want, you need to edit a configuration file.

The file in question is “MMDocumentTypes.xml”. This file can be found in your Macromedia Dreamweaver MX application directory, under the sub-directories Configuration and DocumentTypes. On Mac OS X, the root path is /Applications/Macromedia Dreamweaver MX/Configuration/DocumentTypes/MMDocumentTypes.xml

Open this file in a text editor such as BBEdit, or Dreamweaver MX’s code view. In there you simply need to type in the file extension you wish in the appropriate section. So for instance, I wanted to use “.inc” for all my server side include files, and have them render in Dreamweaver MX as standard HTML. So I added the “inc” value to the first line to the winfileextension and macfileextension properties, where it reads ‘documenttype id=”HTML”‘. However, if you want your custom extension to act like JSP or PHP, you could change the file appropriately. Save the file and restart Dreamweaver, and you should be ready to go.

If your custom file extension now opens in Dreamweaver MX, but only in code view, then there is one more step. Open Dreamweaver MX’s Preferences panel and click on File Types / Editors. In the top field where it is labeled “Open in Code View”, locate and delete your custom file extension.

That should do it.