How to add Perl support for Adobe Dreamweaver CS5 and the .cgi extension with color coding and syntax highlighting

AID: 4600
  • Status: Published

2290 points

  • Bykallmekid
  • TypeTips/Tricks
  • Posted on2011-02-26 at 21:06:21
Awards
  • Community Pick
I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to do it in a way that would support DreamWeaver's color coding and syntax highlighting as well. I also wanted to be able to open files with a .cgi extension by double-clicking on the file rather than launching Dreamweaver, searching for the file, etc.

First, a little background for the youngsters: Before PHP and ASP became popular, Web developers used the Common Gateway Interface (CGI) to process forms and such. A URL was used to point to a CGI script on the server (usually in the cgi-bin folder) and the form could be processed. The CGI script could be built in any of several languages, the most common being Perl. And a great way to simplify everything was to name all CGI scripts with the .cgi extension. In this way you could configure your webserver to treat all files with a .cgi extension as CGI scripts.

The first step was to find out how DreamWeaver decides which file extensions are supported. I scoured the internet for information on how to add file extensions to the DreamWeaver program. After several hours of searching I finally came up with a way to achieve our goal!

You will need to edit two files to add the .cgi extension with the full capabilities of Dreamweaver CS3, 4, 5, and beyond. These two files are an .xml file and a .txt file. Remember that Windows hides known file extensions so you may have to change your settings to make sure you grab the right files. I did not try this on a Mac but I assume the files are named the same. There are lines in the files that allow for enabling these features on a Macintosh, so I think this will work for Mac, you will just have to find the files in the directory they install in the Mac OS.

And here are the steps to make it happen:

  • Open Windows Explorer to the following directory:
    C:\Users\{YOUR_USER_NAME_GOES_HERE}\AppData\Roaming\Adobe\Dreamweaver CS5\en_US\Configuration\DocumentTypes\
    OR from the "Run..." prompt:
    C:\Users\{YOUR_USER_NAME}\AppData\Roaming\Adobe\Dreamweaver CS5\en_US\Configuration\DocumentTypes\PerlDocumentType.xml )

  • Find the file name PerlDocumentType.xml, and open it with a text editor.

NOTE: If you properly installed the Perl Support Extension above, you will see the file. If not, search for it by the name or try to reinstall the Perl extension.

  • In the 3rd line of the file find the following:
    <documenttype id="Perl" internaltype="Text" winfileextension="pl,pm" macfileextension="pl,pm" file="Default.pl" writebyteordermark="false">
    And change it to:
    <documenttype id="Perl" internaltype="Text" winfileextension="pl,pm,cgi" macfileextension="pl,pm,cgi" file="Default.pl" writebyteordermark="false">

  • Finally, use the Windows Explorer and go to: C:\Users\{YOUR_USER_NAME}\AppData\Roaming\Adobe\Dreamweaver CS5\en_US\Configuration
    To use the Run... prompt:
    C:\Users\{YOUR_USER_NAME}\AppData\Roaming\Adobe\Dreamweaver CS5\en_US\Configuration\Extensions.txt

  • Find the file with the name Extensions.txt there.

  • If you properly install the DW Extension for Perl Support, the last line of the file will be:
    PL,PM:Perl files
    change it to:
    PL,PM,CGI:Perl files


Save the file. Close Dreamweaver, and re-open it. Try it out!
Asked On
2011-02-26 at 21:06:21ID4600
Tags

.cgi

,

7

,

add

,

Adobe Dreamweaver CS5

,

coding

,

DocumentType

,

extension

,

extensions

,

highlighting

,

How to

,

Perl

,

PerlDocumentType

,

PerlDocumentType.xml

,

pl

,

pm

,

support

,

syntax

,

Vista

,

Windows

,

color

,

XP

Topic

Adobe Dreamweaver

Views
1253

Comments

Add your Comment

Please Sign up or Log in to comment on this article.

Join Experts Exchange Today

Gain Access to all our Tech Resources

Get personalized answers

Ask unlimited questions

Access Proven Solutions

Search 3.2 million solutions

Read In-Depth How-To Guides

1000+ articles, demos, & tips

Watch Step by Step Tutorials

Learn direct from top tech pros

And Much More!

Your complete tech resource

See Plans and Pricing

30-day free trial. Register in 60 seconds.

Loading Advertisement...

Top Adobe Dreamweaver Experts

  1. jason1178

    87,986

    Master

    0 points yesterday

    Profile
    Rank: Genius
  2. DaveBaldwin

    15,168

    0 points yesterday

    Profile
    Rank: Genius
  3. IanTh

    13,600

    0 points yesterday

    Profile
    Rank: Genius
  4. COBOLdinosaur

    10,664

    0 points yesterday

    Profile
    Rank: Genius
  5. tagit

    9,100

    0 points yesterday

    Profile
    Rank: Genius
  6. LZ1

    8,500

    0 points yesterday

    Profile
    Rank: Genius
  7. SidFishes

    6,500

    0 points yesterday

    Profile
    Rank: Genius
  8. glenn_1984

    6,200

    0 points yesterday

    Profile
    Rank: Sage
  9. Ray_Paseur

    5,072

    0 points yesterday

    Profile
    Rank: Savant
  10. dgofman

    4,936

    0 points yesterday

    Profile
    Rank: Genius
  11. sammySeltzer

    4,800

    0 points yesterday

    Profile
    Rank: Genius
  12. padas

    4,500

    0 points yesterday

    Profile
    Rank: Wizard
  13. _agx_

    4,200

    0 points yesterday

    Profile
    Rank: Genius
  14. Dewmec

    4,000

    0 points yesterday

    Profile
  15. Jen0910

    3,900

    0 points yesterday

    Profile
    Rank: Master
  16. anuradhay

    3,400

    0 points yesterday

    Profile
    Rank: Guru
  17. Nrisimha

    3,064

    0 points yesterday

    Profile
    Rank: Guru
  18. nap0leon

    3,000

    0 points yesterday

    Profile
    Rank: Sage
  19. tommyBoy

    3,000

    0 points yesterday

    Profile
    Rank: Genius
  20. ScriptAddict

    3,000

    0 points yesterday

    Profile
    Rank: Guru
  21. hernst42

    2,800

    0 points yesterday

    Profile
    Rank: Genius
  22. hielo

    2,800

    0 points yesterday

    Profile
    Rank: Savant
  23. eoinosullivan

    2,800

    0 points yesterday

    Profile
    Rank: Genius
  24. worthyking1

    2,800

    0 points yesterday

    Profile
    Rank: Master
  25. gregg_s

    2,250

    0 points yesterday

    Profile
    Rank: Master

Hall Of Fame