Written by Marco Conti Monday, 28 September 2009 16:14
As most of my readers already know, I use Adobe Dreamweaver as my main IDE (Integrated Development Enviroment). While I also use a number of other powerful code editors, like Coda, BBedit, TextMate (on the Mac) and Notepad++, PHP Eclipse and others for PC, Dreamweaver has been my choice for many years, regardless of the low opinion some developers have for this program.
In fact, I found that not only Dreamweaver is a powerful HTML, CSS and PHP editor, but when working with Joomla, Wordpress, Drupal, Magento and pretty much90% of Open Source web scripts out there, Dreamweaver has many advantages , not least the infamous "Design" view, which in split mode can reduce the time it takes to edit dynamically driven templates by a factor of 5. (And incidentally, I am in the process of writing a book on how to apply these techniques to Joomla!).
However, Dreamweaver has a maddening shortcoming, especially for those of us working with file types Dreamweaver does not recognize. If my memory serves (I have set up my own Dreamweaver so long ago that I may be wrong here), Dreamweaver does not recognize .sql, .ini, .htaccess, .config, .info and many more.
In fact, in some cases it won't even open them. However, to have Dreamweaver open these files is fairly easy. Just go to the Preferences > File Types/Editors and insert the missing extensions in the "Open in Code View" field. Save and from that point on Dreamweaver will happily open any of those files.
In fact, just recently I added .csv to the list so I could work on a Virtuemart product import that was driving me nuts.
But even if Dreamweaver can now open those files, it still cannot search them if they are inside a folder and you want to perform a site search (or folder search) to find a string inside one of those files.
Since Joomla 1.5 that's become quite a chore. Joomla 1.0 used to keep all language files in "english.hp" files in the language folder, but since Joomla 1.5 these language files have been moved to .ini files in the same location.
While it was possible once to just perform a folder wide search for any Joomla alert or any text generated by the system, with Joomla 1.5 that's become impossible. Dreamweaver will not search for a string inside multiple .ini files.
We can fix that quite easily though. Dreamweaver keeps these extensions in a file called, quite appropriately, extensions.txt inside the user folder (precise location varies depending on the Operating System and the version). It's a simple matter of finding the extension.txt file and adding any additional extension you may need.
Code coloring is another matter though. I built a few Magento based shopping carts and the first hurdle I had to overcome (among many - Magento is a headache to work with) was that most of the Magento files use an oddball extension for what otherwise are simple .php files: .phtml. Why? Your guess is as good as mine.
The result was that while I could open the .phtml files quite easily, I could not search whithin nor I could use the code coloring. PHP in Black and White is not nearly as fancy as the regular PHP. I could not find diddly!
In any event, let's first tackle how to make Dreamweaver recognize .ini files.
Let's first find this "extensions.txt" file. Below is an excerpt from the Adobe technote located at: http://kb2.adobe.com/cps/164/tn_16410.html (Note: Dreamweaver CS4, in my experience is identical to CS3), depending on your OS, navigate t one of the folders below:
Once you get to the extension.txt file on your system proceed as follows (this is again taken from the Adobe technote mentioned above):
HTML,HTM,SHTM,SHTML,INC INC:Include FilesTo get Design view, color coding, and server behavior functionality (if applicable) working, you need to edit the MMDocumentTypes.xml file, as described below.
Where the Extensions.txt file contains the list of extensions recognized by Dreamweaver, the MMDocumentTypes.xml file contains information about the server model, color coding style, descriptions, and so forth for each known document type.
In addition to adding extensions to the Extension.txt file, new extensions must also be added to the file extension lists for the associated document type. If not, Dreamweaver will not know how to display this file type and will open it in Code view by default. If this extension is not associated with any defined document type, a new document type should be created. To create a new document type, see Extending Dreamweaver (from within Dreamweaver, choose Help > Extending Dreamweaver, and search on MMDocumentTypes.xml).
Steps to add extensions to a document type definition in the MMDocumentTypes.xml file:
<documenttype id="HTML" internaltype="HTML" winfileextension="html,htm,shtml,shtm,stm,tpl,lasso,xhtml" macfileextension="html,htm,shtml,shtm,tpl,lasso,xhtml,ssi" writebyteordermark="false"> winfileextension and macfileextension attributes of the documenttype tag. For example: winfileextension="html,htm,shtml,shtm,stm,tpl,lasso,xhtml,inc" The code above adds the INC file extension to the list of files that Dreamweaver treats as HTML files. Adding extensions to the Mac OS and Windows lists for this file types allows Dreamweaver to open this file type in Design view as other files with defined HTML file extensions.
Note: The order in which extensions are listed is important. The first extension in the extensions lists will be the default extension used for this file type.
That's it, after you have made these changes your Dreamweaver will be able to read, search and interact with many file types it previously ignored.
This information is available elsewhere, the Adobe Technote is the major source, but I decided to include it in my blog so that I can refer to it more easily and because I believe that the more it is diffused the easier it is for Dreamweaver users to find it.
Enjoy
| Next > |
|---|