Tag Archives: IDE

Different folders for sources and deployment

When developing PHP using Netbeans 6.5.1, you probably don’t want to store your projects source files in your web server root, e.g. for version control.

You can choose a different location for your sources and deploy your application in the web server root.

Right cklick your project, choose properties, select Copy files from Sources Folder to another location. Under Copy to folder choose your server root, a folder with the project name will be generated.

Customizing a Netbeans Template

Customizing the Netbeans 5.6.1 PHP Template is easy.

Under Tools/Templates you find the Template Manager. There you can customize the templates for PHP classes and interfaces. In my case I prefer the date given in the PHPDocs in the following format: “2009 Jun 25″. The ${date} variable is a String. Casting this into date type, the output can be formatted according to java.text.SimpleDateFormat, in my case ${date?date?string(“yyyy MMM d”)}.

To change the user name, edit User.properties under Tools/Templates/User Configuration Properties:

user=Code-Kobold (Ron Metten) (www.code-kobold.de)

The template now looks like this:

<?php
/**
 * Description of ${name}
 *
 * @author ${user}
 * @since ${date?date?string("yyyy MMM d")}
 */
 class ${name} {
 } // class ${name}
?>

This generates the following output, when a new PHP Class is created:

<?php
/**
 * Description of Template
 *
 * @author Code-Kobold (Ron Metten) (www.code-kobold.de)
 * @since 2009 Jun 26
 */
 class Template {
 } // class Template
?>