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”
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).
/Users/[current user]/AppData/Roaming/Adobe/Dreamweaver CS4/[locale]/Configuration/Extensions.txt
after PHP5 put PHTML. Dreamweaver will now open phtml files to!
Thanks Rein. Was just about to answer and looks like you’ve solved it!
Thank you very much..
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!