Dreamweaver Syntax Highlight Tip
I use Dreamwweaver CS3 for all of my code editing, and I currently have the pleasure of working with the new Magento Shopcart Software. While adding Shadowbox to the cart, I ran into the small problem of Magento template files that use the rare .phtml file extension. As Dreamweaver by default does not color code the syntax, it makes it difficult to read the php code that makes up the template file.
Here is how I added syntax highlighting to a specific file type that is not listed by default in Dreamweaver.
First, I noted what language the template file is made up of. Even though the file extension is .phtml, I know that the actual language is php.
Second, I opened the document type config file in the Dreamweaver installation folder. This should be found in this general area.
C:\Program Files\Adobe\Dreamweaver CS3\Configuration\DocumentTypes\MMDocumentTypes.xml
I opened the file with Notepad, and hit Control + F, and entered winfileextension=”php as my search query. This jumped me down to where the list of file types that use a specific syntax highlighting. My list appeared as winfileextension=”php,php3,php4,php5″.
All I did was add a comma and phtml to the end of that list:
winfileextension=”php,php3,php4,php5,phtml”
Then I saved the file and restarted Dreamweaver. Now any file with the .phtml file extension receives the same syntax highlighting as a php document.
Before and After










June 20th, 2008 at 11:28 pm
Thanks Chad! Perfect timing.
Just started a new project at work using the Zend framework and while I could get DW to recognize the extension, syntax highlighting wasn’t working.
June 25th, 2008 at 4:33 pm
Glad to help. You bring up another good trick.
Allowing DW to recognize and edit a specific file type
In DW, go to EDIT > PREFERENCES
At the end of the list of extensions, hit space, and add your new file extension type.
I added these 3: .htaccess .info .htpasswd
June 28th, 2008 at 3:08 am
Thx Chad,

I was alreday hatin dw for not letting me assign syntax schemes to specific filtypes in the prefs dialog! Wave your mouse in the air and say idahooooooo!
Mortimer
June 28th, 2008 at 10:58 am
Haha. Thats actually how I start my mornings at work, every day.
June 28th, 2008 at 6:55 pm
I too have problems with the color syntaxing, I tried everything to get the code color enabled. I followed the instructions, but the file won’t allow me to save. Do I have to do it in administrative mode?
September 20th, 2008 at 8:24 pm
Found the problem.
I used PTHML instead of PHTML
Works perfectly now!
November 8th, 2008 at 9:28 pm
Thanks for the write up, this also lead me to change the colour syntax for the ‘null’ attribute. By default dreamweaver only converts the uppercase value to green (Which is annoying seeing the true & false attributes are not case dependant) For those interested heres how to do it.
Open up the file:
C:\Program Files\Adobe\Adobe Dreamweaver CS4\configuration\CodeColoring\PHP.xml
Note: I had to copy the file to my desktop, edit then paste back because of Vista’s security…
Anyways… search for ‘NULL’ and you should find this line: NULL
Directly above it add: null
Save and reboot
November 13th, 2008 at 4:39 am
Just what i was looking for - thank you