Getting Dreamweaver CS4 to code highlight .phtml files

I’m currently working on a Magento project which requires some custom template work and with Dreamweaver, it doesn’t color code the syntax for .phtml files even though they are just php files in disguise. A simple solution would have been to allow different extensions to be specified in the preferences but of course, hiding it away in a obscure config file is more fun.

The file to look for : (check your installation path)

C:\Program Files\Adobe\Adobe Dreamweaver CS4\configuration\DocumentTypes\MMDocumentTypes.xml

Search for this code snippet :

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

and change it to :

<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”>

Restart Dreamweaver and say goodbye to the wall of black text! This will also work for any other syntax that needs to be highlighted and isn’t represented by the usual file extension, you’ll just need to find the correct documenttype id.

Related posts:

  1. Fix for Dreamweaver CS 4 : Server Model SSI.htm: has configuration information that is invalid
  2. Quick way to create patch files based on modified date with xcopy
  3. Moving from WebCollab to activeCollab for project management
  4. Re-installing Windows XP on a Dell Inspiron Mini 9 (910) with a USB drive

5 thoughts on “Getting Dreamweaver CS4 to code highlight .phtml files

  1. Rein

    Thanks for this info. Works for me!
    But i can’t open a document on the normal way (just click it). Is there any way to let dreamweaver open phtml files (not by chosing > open with > dreamweaver each time).

  2. Rein

    Edit also:
    /Users/[current user]/AppData/Roaming/Adobe/Dreamweaver CS4/[locale]/Configuration/Extensions.txt

    after PHP5 put PHTML. Dreamweaver will now open phtml files to!

  3. Danie

    My oh my.

    I had EXACTLY the same problem, developing on a magento store, and the black and white code was breaking my brain. THANK YOU so much for this.

    You have no idea how much you helped me!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>