DHTMLdev.com — Dedicated to quality Web development articles and tutorials
Registering File Extensions for Code Highlighting in Dreamweaver PDF Print E-mail
Thursday, 26 July 2007

Dreamweaver is my production HTML, JavaScript, PHP et al. editor. As such, Dreamweaver needs to correctly highlight all kinds of code in all kinds of document types. For example, I'm learning Drupal. Drupal uses modules to extend the core. These module files are PHP but use the file extension .module, which Dreamweaver does not recognize as PHP code, until we register the .module file extension as the PHP document type.

The Trick is ...

Dreamweaver is already setup up to recognize PHP files. We just need to add .module to the list, which already includes .php, .php4, and .php5. If we .module to that list, then Dreamweaver will recognize my Durpal .module files as PHP code and highlight them as such, making coding much cheerier for me. The file we are interested in, on my install, is C:\Program Files\Macromedia\Dreamweaver 8\Configuration\DocumentTypes\MMDocumentTypes.xml.

Mmm ... mm ... MMDocumentTypes.xml

Open MMDocumentTypes.xml. We are interested in the documenttype element with id="PHP_MySQL". It has two attributes that define file extensions for windows and mac, winfileextension="php,php3,php4,php5" and macfileextension="php,php3,php4,php5". I edited winfileextension to add .module and .inc files as PHP. So now I have winfileextension="php,php3,php4,php5,module,inc".

I added "module,inc" to the winfileextension attribute value.

<documenttype id="PHP_MySQL" servermodel="PHP MySQL" internaltype="Dynamic" winfileextension="php,php3,php4,php5,module,inc" macfileextension="php,php3,php4,php5" file="Default.php" writebyteordermark="false">

Restart Dreamweaver and Viola

After restarting Dreamweaver, open a .module or .inc file and all the PHP code is highlighted correctly.

Last Updated ( Thursday, 26 July 2007 )
 
< Prev   Next >