Subscribe to my full feed.

Wednesday, September 19, 2007

HowTo: Enable Alternate File Types in Dreamweaver 8

I ran into a problem when developing a module for Drupal. For a Drupal module, the php files end in a module extension. But when trying to open one of these documents in Dreamweaver, you receive the following error, "Can't find a valid editor for this file extension."

To fix this problem, you have to edit two files that control how Dreamweaver operates. To edit these files, you can use any text editor. Since I am doing this on a windows machine, I am going to use notepad.

The instructions below were taken from Adobe's Support Site which can be found here. Below are the instructions for Windows XP and Macromedia Dreamweaver 8. The source for these instructions also has instructions for Mac OS X and Vista as well as CS3 Dreamweaver.

First we need to enable viewing of hidden filesTo show hidden files, hidden folders, and extensions for known file types:

1. In Windows Explorer, do one of the following:
* In Windows XP, choose Tools > Folder Options.
* In Windows Vista, choose Organize > Folder and Search Options.
2. Click the View tab in the Folder Options dialog box.
3. In Advanced Settings, select Show Hidden Files And Folders.
4. Deselect Hide Extensions For Known File Types.
5. Click OK.

To add file types to the Extensions.txt file:

  1. Locate the Extensions.txt file within the Dreamweaver user configuration folder. The location of this folder depends on the operating system and the version of Dreamweaver:
    • Dreamweaver 8 on Windows XP & 2000:
      C:\Documents and Settings\[username]\Application Data\Macromedia\Dreamweaver 8\Configuration

  2. Open Extensions.txt in any external text editor like Notepad or Text Editor. Do not modify the Dreamweaver configuration files in Dreamweaver itself.
  3. Add the extension to the All Documents line. Extensions must be in uppercase letters and separated by commas.

    Example: HTML,HTM,SHTM,SHTML,MODULE

  4. To add extensions to an existing document group, add the extension to the extension list for the desired group.

    Example: PHP,PHP3,PHP4,PHP5,TPL,MODULE:PHP Files

    (This can also be added to the Server Side Include list already within the file.)

  5. Save the file and restart Dreamweaver.

Steps to add extensions to a document type definition in the MMDocumentTypes.xml file:

  1. Locate the MMDocumentTypes.xml file in the main Dreamweaver configuration folder (not the Dreamweaver user configuration folder). The location of this folder depends on the operating system and the version of Dreamweaver:
    • Dreamweaver 8 on Windows Vista, XP & 2000:
      C:\Program Files\Macromedia\Dreamweaver 8\Configuration\DocumentTypes
  2. Open MMDocumentTypes.xml in any external text editor like Notepad or Text Editor. Do not modify the Dreamweaver configuration files in Dreamweaver itself.
  3. Find the tag set for the desired document type. Below is the default document type definition for PHP documents from the MMDocumentTypes.xml file:

  4. Add the desired extension to the winfileextension and macfileextension attributes of the documenttype tag. For example:
    winfileextension="html,htm,shtml,shtm,stm,tpl,lasso,xhtml,module"

  5. Save MMDocumentTypes.xml and restart Dreamweaver.
I hope this helps other people, as it took me a while to find a fix for this myself.

Chris

3 comments:

Anonymous said...

I added MODULE and INC in both files, but I still can't do a Search in Dreamweaver and have Dreamweaver search in files ending in .module or .inc. Do you know how to have Dreamweaver search in files other than .php, .html, etc?

Chris said...

I am quite confident that in order to search through a document, the extension assignment needs to be in the extensions.txt file. If you have done this and still cannot properly search those files, you may want to consider completely uninstalling your dreamweaver install. Re-install, download and install any available updates and re-edit the configuration files. Hope this helps.

Gideon said...

when I run this I het the following "Repair terminated unexpectedly" now what?