06 Sep 2009

Adding a file type for syntax highlighting in Dreamweaver

Technical, Tutorials posted by Brandon Showers

I develop most of my website applications with CakePHP which use view files with the file extension *.ctp. This means I lose syntax highlighting in Dreamweaver so I decided to add a new document type for syntax highlighting doing the following:

  1. Navigate to your dreamweaver directory
  2. Open the file ‘configuration/DocumentTypes/MMDocumentTypes.xml’
  3. Pick the syntax highlighting you want, in my case it was PHP so I searched for that extension in my XML doc.The line will look something like this
    <documenttype id="PHP_MySQL" servermodel="PHP MySQL"
    internaltype="Dynamic" winfileextension="php,php3,php4,php5"
    macfileextension="php,php3,php4,php5" file="Default.php"
    writebyteordermark="false">

    You’ll want to add the extensions you want where it says fileextension=”…”. The new line will look like this

    <documenttype id="PHP_MySQL" servermodel="PHP MySQL"
    internaltype="Dynamic" winfileextension="php,php3,php4,php5,ctp”
    macfileextension=”php,php3,php4,php5,ctp” file=”Default.php”
    writebyteordermark=”false”>
  4. Save the file and restart Dreamweaver and you should be good to go!

Leave a Reply