Home > General, JavaScript > NetBeans code templates

NetBeans code templates

November 21st, 2008

I am so excited about new NetBeans 6.5. It’s definitely my number one choice when it comes to PHP development. Today I got carried around in playing with Code templates (Tools > Options > Editor > Code Templates). This is personal favorite of mine in NetBeans. If you are like me and you do a lot of Magento developement then you are most likely to use a lot of inline code. I also use a lot of

<?php echo ‘<pre>’; print_r($variable); echo ‘</pre>’; ?>
and
<?php echo ‘<pre>’; Zend_Debug::dump($$${variable}); echo ‘</pre>’; ?>

With code templates you can add a new template. If you add a new template with abbreviation “de” and add a content like

echo ‘<pre>’; print_r($$${variable}); echo ‘</pre>’; ?>

Then all you need to do while writting code is something like

<?php de+TAB

and you get

<?php echo ‘<pre>’; print_r($variable); echo ‘</pre>’; ?>

For me this is a huge time save. I use a lot of these during development.

This is my favorite

<?php echo ‘<pre>’; print_r($variable); echo ‘</pre>’; die; ?>

Bellow you can see a screenshot of NetBeans code templates.

NetBeans code templates

NetBeans code templates

I’m loving it :)

Interesting? Share it!
  • Digg
  • del.icio.us
  • Google
  • Technorati
  • Facebook
  • TwitThis
  • description

Related articles

  • No Related Post

General, JavaScript

  1. November 22nd, 2008 at 09:14 | #1

    hi branko,
    I’ve discovered NetBeans about 2 weeks ago, and I really like it. This post about code template has been very usefull to me: I had seen this option but didn’t understood it well. I do now and will add some of my own. Thanks for this.
    Yesterday I’ve tried the Developer Colaboration plugin with a friend of mine living in Paraguay (I’m based in Spain) and that was amazing!
    I’m taking a look to the tutorials of NetBeans website, but if you have more advices, don’t hesitate of writing another post :)
    cheers

  2. November 22nd, 2008 at 09:20 | #2

    The only thing I have to say negative about NetBeans is speed… This is not it’s greatest attribute :)

    Surely it’s due to the fact it’s written in Java language but… somehow I have the strange feeling it works faster under Linux. Still… cat give my Windows box :)

  3. November 22nd, 2008 at 18:38 | #3

    I’ve been using Netbeans with Java since version 5.0. But also I work with Eclipse (it’s my selected + PhpEclipse + Aptana + Subversion + Pydev).
    I’m testing now Netbeans 6.5 for Php, but I not sure if I’m gonna change Eclipse.
    ’til now, I can’t find the reason to use to Netbenas instead Eclipse for Php.

  1. No trackbacks yet.