Dreamweaver is the Swiss Army knife of web development. It offers features that cater to the seasoned web developer and web designer.  It also caters to the beginner. But, have you ever wanted to modify Dreamweaver to fit the needs of specific projects?

For example, the Dreamweaver code hints are missing the PHP oci_ functions. Also, when you create a new PHP page, it is auto filled with HTML. If you wanted an HTML page, you would have created a new HTML page.

In this post we are going to cover how to modify Dreamweaver to better suite our specific project needs. As always, MAKE A BACKUP COPY OF YOUR ORIGINAL FILES. Never save over a file without making a backup of the original.

Also, you will need to be able to view hidden files. You can make hidden files visible in Windows Explorer by clicking on Tools and then Folder Options, then click on the View tab and under Hidden files and folders, click Show hidden files and folders.

One final reminder, NEVER use Dreamweaver to modify a Dreamweaver configuration file. It’s like typing “Google” into Google’s search engine. Bad things will happen.

Modifying the Default Appearance of a New File

As you might have guessed, the default appearance of a new file is saved in Dreamweaver with the title “Default” followed by the specific extension. For example, the appearance of a new PHP file is saved as Default.php.

For CS4, these default files are located in

C:\Program Files\Adobe\Adobe Dreamweaver CS4\Configuration\DocumentTypes\NewDocuments.

The Default.php file should look something like this:

default.php

Like we mentioned in the introduction, if we wanted an HTML page, we would have created a new HTML page. We like to have our PHP documents contain actual PHP code.

Rename the Default.php file to something like Default.ORIGINAL.php. Next, create your own custom default PHP file and save it as Default.php. If you get a warning about Default.php already exists, then you didn’t rename the original. Rename the original and retain it as a backup. Our custom default PHP file looks something like this:

Default

That looks more like a default PHP page!

Modifying Code Hints

Dreamweaver makes use xml to control the code hints feature. In CS4, the location of this file is

C:\Program Files\Adobe\Adobe Dreamweaver CS4\configuration\CodeHints\CodeHints.xml.

Open this file in your favorite editor (other than Dreamweaver). It probably looks something like this:

codehints.original

You will notice this image above shows the area of the file that contains the PHP_MySQL functions for code hints. You will also notice there are no oci_ functions. It’s important to keep all of the functions in alphabetical order.

Next, copy line 1942 and paste it back into the document and change the pattern to the pattern listed at www.php.net/oci_bind_by_name. Your new Default.php file should look something like this:

codehints.new

Save the file and close it. Now, open Dreamweaver or restart Dreamweaver if you already had it open. Create a new PHP document and try out the code hints for the oci_bind_by_name function. Hopefully you see something like this on the screen:

codehint.visible

Once the function name is complete, hopefully you see something like this:

codehint.function

You’ll notice, once you have the function and parameters in place, the function is not colored properly. Let’s fix that…

Modifying Code Coloring

Just like Code Hints, Dreamweaver makes use of an xml file to control code coloring. In CS4, the location of this file is

C:\Program Files\Adobe\Adobe Dreamweaver CS4\configuration\CodeColoring\PHP.xml

Once you open the PHP.xml you will notice it is divided up into different sections. The section we want to modify is located under the CodeColor_PHPScriptFunctionsKeywords portion of the file.

In our file, it starts around line 374. In this section you will notice a list of keywords that should be colored as PHP functions when they are typed into Dreamweaver. Again, these are in alphabetical order, so you want to insert the keyword oci_bind_by_name in its proper place. When you are finished, it should look something like this:

codecolor.new

Save this file and close it. Open Dreamweaver, or restart Dreamweaver if you already had it open. Go ahead and type out the oci_bind_by_name function again and see if it is colored when you are finished. It should look something like this:

codecolor.working

As you can see, the new function is now colored properly.

Review

In this post we discussed a couple of basic modifications to Dreamweaver. Don’t forget, before modifying any Dreamweaver files, backup the originals. Also, never modify a Dreamweaver configuration file with Dreamweaver. Bad things can happen.

Stay tuned for future Dreamweaver modification posts where we will walk you through creating brand new file types and enhancing code completion for PHP functions.