By: Ray West
Page 1 of 1
To start with, this is not a part of the Creating Web Sites with Drupal series. This article is for developers who are writing and/editing Drupal modules. It is not an advanced article per se, but it is typically only needed by people doing advanced things with Drupal.
This article is for those of us who still love Dreamweaver for its interface, its design view, and its built-in site management and FTP, but need to work with Drupal module files with the .module, .install, .info and other file extensions. To Dreamweaver, these are not recognizable files and it will not want to open them. Even when you get them opened, Dreamweaver will not use its normal PHP color coding and you will just get black text. This can make it tough to find things in your files and tell when things are comments, among other issues. This article will show you how to get Dreamweaver to open these files from the site manager and how to use Dreamweaver's built in PHP color coding for all these weird file extensions.
Getting Dreamweaver to Open the Files
Before performing this step, if you double-click on a module or info file in the site manager, Dreamweaver will tell you that it does not know how to open that file type and will want to know which external editor you want to use. We would not be in Dreamweaver if we wanted to use an external editor on these files, after all, they are just PHP and Dreamweaver is supposed to know how to do PHP.
You can add files to the list of file types that Dreamweaver will use its code view to open. Go to Dreamweaver's Preferences menu (in the Dreamweaver menu on a Mac and the Edit menu on a PC). In the File Types/Editors section of the Preferences panel, you will see a list of file extensions labeled Open in Code View. Add whatever file extensions you need to edit to the end of this list.
Note: There are no commas in this list, just a space between each file type.
Image 1: Adding the Drupal file extensions to the list of files that DW will open in Code View
Now, when you double-click on one of these file types in the Site Manager, Dreamweaver will open it. But it will treat it as regular text with no recognition of the code elements in the file. We need to edit a couple of configuration files to get that working.
There are two Dreamweaver configuration files that you need to edit to get code-coloring working on these files. As always, messing with config files can be dangerous and I recommend you back up your original files before proceeding.
You will find the files in Dreamweaver's configuration folder. On a Mac that is in Applications/Adobe Dreamweaver (version)/Confguration. On the PC it is at X:/Program Files/Adobe/Adobe Dreamweaver (version)/Configuration where X is the drive where Dreamweaver is installed.
In that directory locate the file Extensions.txt and open it in an editor other than Dreamweaver (like Notepad or TextEdit). This file defines the file extensions recognized by Dreamweaver and associates them with a file type. We want to associate these module files with the PHP_MySQL file type.
The top line of this file lists all of the document types that Dreamweaver will recognize. Add your file extensions to the end of this list, all caps, and no periods. The end of this line will now look like this:
Now skip down to the line that ends in PHP Files and add them again to associate them with the PHP file type. That line will now look like this:
Save that file.
Next locate the file MMDocumentTypes.xml in the DocumentTypes folder (that is Configuration/DocumentTypes/MMDocuments.xml). In this file, locate the document type XML node that begins:
There are two file extension attributes that need to be edited called winfileextension and macfileextension. Add the file extensions, this time with commas but still no period, so that the node reads like this:
<documenttype id="PHP_MySQL" servermodel="PHP MySQL" internaltype="Dynamic" winfileextension="php,php3,php4,php5,module,info" macfileextension="php,php3,php4,php5,module,info" file="Default.php" writebyteordermark="false">
Save the XML file.
Now when you launch Dreamweaver and open a Drupal module, info, install, or other file extension that you have added to these files, they will display as PHP files with color-coding and be much easier to work with.
Page 1 of 1 1