Adding a file type for syntax highlighting in Dreamweaver

Monday, November 10th, 2008

I’m using a proprietry open source Ecommerce system to complete a project at the moment all it’s file extensions are renamed to *.phtml.  This means I lose syntax highlighting in Dreamweaver, to add a new document type for syntax highlighting you can do the following:

  1. If you’re using a Mac CMD click on the Drewamweaver app, this will open the install directory; if not just navigate to the directory.
  2. Open the file ‘configuration/DocumentTypes/MMDocumentTypes.xml’ file - in Dreamweaver why not.
  3. Pick the syntax highlighting you want, in my case it was PHP so I scrolled down or search for the extension in the XML doc.  In my case PHP was on line 75.
  4. The line will look like

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

    You want to add the extension you want where it says fileextension=”…”. If you’re Mac you can ignore the winfileextension and vice versa if you’re Windows. The new line will look like

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

  5. Restart Dreamweaver, and voila.

Posted in:

Comment On This Post