iTechtalk


If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.



Reply
Old 11-03-2008, 11:21 AM   #1 (permalink)
Junior Member
 
Join Date: Nov 2008
Posts: 4
Post Using a specialized script editor

Using a specialized script editor



Although you can write PHP classes in Notepad or TextEdit, you can make your life a lot easier by choosing a specialized editor with built-in support for PHP. A good script editor should offer at least the following features:

Line numbering: Being able to find a specific line quickly makes troubleshooting a lot easier, because PHP error messages always identify the line where a problem was encountered.

A “balance braces” feature: Parentheses, square brackets, and curly braces must always be in matching pairs, but the opening and closing ones can be dozens or even hundreds of lines apart. Some editors automatically insert the closing one as soon as you type the opening one of the pair; others simply provide a way of identifying the matching pairs. Either way, this is a huge time-saver.

Syntax coloring: Most specialized script editors highlight different parts of code in distinctive colors. If your code is in an unexpected color, it is a sure sign that you have made a typing mistake.

Code collapse or folding: When working with long scripts, it is useful to be able to hide sections of the code that you are not currently working on. Some editors automatically identify related code blocks making them easy to collapse; others rely on you selecting the code you want to hide manually.

Code hints and code completion: Unless you have a phenomenal memory, you will probably be grateful for a reminder of the spelling of PHP functions and the arguments they take. Most dedicated PHP editors have hints for several thousand functions and automatically complete the name when you select it from a pop-up window.

In PHP Solutions: Dynamic Web Design Made Easy, I said my personal choice for writing PHP scripts was Dreamweaver. Dreamweaver offers all the features just listed, so I still think it is a good choice for PHP, particularly if you are involved in designing the front end of PHP web sites. However, for serious work with OOP, Dreamweaver lacks the more advanced features offered by a dedicated PHP IDE, such as Zend Studio for Eclipse or PhpED.


I won’t go through all the extra features, but those I have found most useful are as follows:

Instant error analysis: If you have ever hunted for a missing semicolon, this is one of the most useful features of a dedicated editor. The editor constantly scans your code looking for syntax errors. If it spots one, PhpED underlines the error with a wavy red line and displays an appropriate message as a tooltip when you float your mouse pointer over it.

Zend Studio for Eclipse also draws a wavy red line under syntax errors but draws your attention to them by displaying a white x in a red circle next to the number of the affected line. In case you miss it, the error is also listed in the Problems view (panel).

Code introspection: This is really important when working with OOP. The IDE keeps track of user-defined classes, variables, and functions in the current project and enables code completion for them, too.

Automatic documentation: If you comment your code using the PHPDoc format, both PhpED and Zend Studio generate automatic documentation that is displayed as part of the code hints, although they display them in slightly different ways. PhpED displays the full description in a pop-up window when the cursor is between the parentheses of a function or method. If you use a heavily documented framework, such as the Zend Framework, this can look rather overwhelming onscreen.

Zend Studio for Eclipse takes what I think is a more practical approach. Instead of displaying the full description, it displays just a summary at the same time as the code hints pop-up menu. This is easier to read and helps you choose the appropriate method. Once you make your choice, code hints showing only brief details of the arguments are displayed.

Both Zend Studio for Eclipse and PhpED are commercial products, costing several hundred dollars, so it is worth downloading the trial versions and giving them a thorough test before deciding which one is right for you—or, indeed, if either of them is. PhpED is Windows only, but Zend Studio is available for Linux, Windows, and Mac OS X 10.4 or higher. Zend Studio for Eclipse automatically installs everything on your computer; there is no need to install Eclipse separately beforehand.
crazy4 is offline   Reply With Quote
Reply

Bookmarks

Tags
php, script, script editor, using script editor

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:19 AM. itechtalk