Eclipse/ZendStudio custom username for Code Templates

At work we started using Zendstudio, as the installation on our Linux Boxes is global, we can’t edit the ZendStudio.ini, and the only way to specify our custom username for Code Templates is using the commandline arguments. The easiest way is to create a shell script to start ZendStudio:


#!/bin/bash

###### CONFIG ######
ZENDPATH="/opt/ZendStudio/ZendStudio"
USERNAME="Marco Neumann"
USERMAIL="webcoder_at_binware_dot_org"
####################

USERSTRING="$USERNAME"
if [ ! -z $USERMAIL ]; then
    USERSTRING="$USERSTRING <$USERMAIL>"
fi

$ZENDPATH -vmargs -Duser.name="$USERSTRING"

Now ZendStudio will replace the variable ${user} in your Code templates with Marco Neumann

Here is an example for “Simple php file” in ZendStudio (You will find it in ZendStudio under Window/Preferences/PHP/Code Style):

  • Code Template

  • Ouput

 * @author     Marco Neumann 
 * @version    $Id:$
 */
 
/**
 * SHORT_DESCRIPTION
 *
 * LONG DESCRIPTION
 *
 * @category   CATEGORY
 * @package    PACKAGE
 * @subpackage SUBPACKAGE
 * @copyright  Copyright (c) 2011 Marco Neumann 
 */

This also works with Eclipse and I think it would also work with Netbeans, but haven't tested it.

Leave a Reply