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 FilesAdobeAdobe Dreamweaver CS4configurationDocumentTypesMMDocumentTypes.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.


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

  1. 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. 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 says:

    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

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s