Musings

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.

Standard