Thursday, July 01, 2010

Coding Drupal in Dreamweaver CS5

I've used big IDEs in the past: all the Drupal gurus/ninjas/whatever use Eclipse, Netbeans or something way over the top. My big project programming days are well and truly over - kicked the arse out of it over the years in BASIC, Pascal, FORTRAN, CORAL, ADA, Java and C++. When I started using Drupal to build websites, my aim was to avoid touching its underlying language, PHP.  Managed that for 2 years, but recently have had to geek out to do a few cheeky things, either in the theming layer or some simple modules. My knowledge of PHP, jQuery and the Drupal API is pretty minimal, so need the following to write code:
  • Code hints (for PHP, jQuery and the Drupal API)
  • Code colouring (keep life simple)
  • Basic syntax checking (not debugging)
  • Integrated FTP and version control client.
Tried Smultron and TextMate, which are great, but can be a bit limited. With the relaunch of Adobe's Dreamweaver (version CS5) all of the above is now possible, with a load more CMS goodies (see http://www.adobe.com/products/dreamweaver - and there's an intro on lynda.com too). OK, you only get SVN support and no Git, but everything else on my list now works well.

Here's how to set up Dreamweaver:
  1. Find the Dreamweaver configuration files, MMDocumentTypes.xml (on OSX at /Applications/Adobe Dreamweaver CS5/Configuration/DocumentTypes) and Extensions.txt (on OSX at /Applications/Adobe Dreamweaver CS5/Configuration).
  2. In MMDocumentTypes.xml add file extensions to the PHP section (you'll need to scroll through the XML to find it):

    <documenttype file="Default.php" id="PHP_MySQL" internaltype="Dynamic" macfileextension="php,php3,php4,php5,theme,module,engine,inc" servermodel="PHP MySQL" winfileextension="php,php3,php4,php5,theme,module,engine,inc" writebyteordermark="false">
    </documenttype>


  3. In Extensions.txt change the line ending in : All Documents to include MODULE,THEME,ENGINE,INFO,INC,INSTALL and the line ending in : PHP Files and append the following extensions MODULE,INC,THEME,INSTALL
  4. Open Dreamweaver and edit your preferences:
    • Code format: indent with 2 spaces; Tab size to 2
    • File Types/Editors - open .module, .theme, .engine, .info, .inc, .install in code view (add to the list of existing extensions)
  5. Create your site locally and set up in Dreamweaver (Site > Manage sites). Then open any page and it should recognize it's part of a bigger thing.... so go to Site > Site-Specific Code Hints and set the 'Structure' to Drupal. Use the same process to add specific libraries (see following video)
Err... that's it

    No comments:

    Post a comment