You are on page 1of 12

pdfcrowd.com open in browser PRO version Are you a developer?

Try out the HTML to PDF API


Useful NetBeans 6.8 PHP tips
POSTED 05/02/201 0
NetBeans has introduced a very powerful development environment for PHP since version 6.5. It has
some features that make development even easier. Until NetBeans has launched its 6.8 version, it
introduced many features for PHP developers. Here is some features:
Code templates
Code templates is a very powerful feature that can save a lot of time. This templates enables the
developer to write few characters which can be expanded to language expressions. Netbeans comes
with an excellent group of expressions, but you can add your own templates. Go to tools > options
Tiplite
CakePHP Netbeans System Administration Ruby
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API
then in the editor section choose Code templates.
Code templates editor in NetBeans PHP editor

pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API
Some useful templates can be:
cls: initialize a class with a contructor.
fnc: expands to a function.
fore: foreach statement (foreach($array as $variable))
forek: foreach statement with a key (foreach($array as $key => $var))
to expand an abbreviation press tab, you can set expand trigger also in the code templates editor.
Extend code templates with Zen Coding
PHP is usually combined with HTML, although it should only be simple statements in view files if
you are using MVC pattern. Zen coding project offers a set of code templates for rapid HTML
coding.Unfortunately NetBeans didnt get the full power of Zen coding yet, it only provides code
templates :(.
Download Zen coding for NetBeans you will get a ZIP file. Use the code template editor and click
Import and select this file, then restart NetBeans. Now you get a powerful HTML snippets for
NetBeans. You can get a list of all snippets here.
Useful code templates trick, surround with
Some code templates in NetBeans, and in the template provided with Zen Coding, can be used to
surround some text with a code template. This can be useful if you forget, or needed later, to
surround some code with certain code template. An example for this is if conditions, loops, .etc.
Those code templates can be used if you select the required code. You will find a small yellow light
bulb on the left side of the code, click this bulb to show a list of those templates.
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API
Introduce a variable
NetBeans is very smart when it scans for variable types. It utilizes comments, specially PHPDoc.
Variable types is very useful when the IDE displays code completion. But sometimes when you are
working on many files many IDEs and code editors doesnt identify this variable types so the user will
miss the code completion feature of the IDE, which saves a lot of time while coding. To retrieve code
NetBeans code templates surround with dialog

pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API
completion feature again. You can tell NetBeans about the variable type yourself using the following
method.
This will tell NetBeans about the variable you are using and if it is an instance of some class
NetBeans will show code completion when required. This can be great if you are using a PHP
framework that uses MVC pattern. Personally I use this technique to acquire code completion for
CakePHP helpers,
Even I could use it to get completion for $this in views like this:
Editor folds
Editor folds is a way to group some code in a fold and give them a label. Editor folds looks like this:
1 /* @var $variable VariableType */
1
2
3
/* @var $html HtmlHelper */
/* @var $javascript JavascriptHelper */
/* @var $form FormHelper */
1 /* @var $this View */
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API
15 COMMENTS ON USEFUL NETBEANS 6.8 PHP TIPS
4
to create an editor fold with following code:
You can ignore defaultstate="collapsed" to make the code visible just after you open the file.
Please take care of order and case of syntax.
Editor folds in NetBeans

1
2
3
//<editor-fold defaultstate="collapsed" desc="your description here ...">
// your code here ....
//</editor-fold>
Youssef Alsherif on 05/02/2010 at 11:38 am said:
Good Tips
Reply
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API
Mystic
on 05/02/2010 at 4:03 pm said:
Thanks for your visit Youssef. There is still more.
Reply
Giuseppe on 17/02/2010 at 1:09 am said:
Hi, thanks for these tips. Just a little request though: Introduce a variable is not so clear. Could
you make a little video to show how they works? Thanks a lot.
Reply
Mystic
on 17/02/2010 at 10:55 pm said:
It is very easy you can tell NetBeans about the type of the variable you are using. It is useful
if you are using many files and NetBeans couldnt determine the type of a variable so you
can tell NetBeans yourself using this method.
Reply
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API
Pingback: Tower Of Power - Netbeans Code Completion and your
Zend_View
Pingback: Webs Developer Daniel Cousineaus Blog: Netbeans
Code Completion and your Zend_View
Mustinet on 21/02/2010 at 7:59 pm said:
i read netbeans wiki but i didnt understand it. because wiki page in russian thanks for tips.
Reply
Php Programmer on 30/03/2010 at 3:41 pm said:
Useful
Thanks for the tips.
Reply
Serge on 27/07/2010 at 12:31 pm said:
Thanks for sharing this! Very useful!
NetBeans IDE rocks :]
Reply
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API
cakephp developer on 30/07/2010 at 4:46 am said:
thanks for the tip on editor-fold, very useful!
Reply
TRouBLeSHooTeR on 22/10/2010 at 12:29 am said:
thanks for tips,useful
Reply
Lorenzo on 03/02/2011 at 7:03 pm said:
Full support is now available!
https://github.com/lorenzos/ZenCodingNetBeansPlugin#readme
Reply
Hosting Best on 10/05/2011 at 5:17 pm said:
An awesome time saving piece of software, def recommend
Reply
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API
Bruno Batista on 28/06/2012 at 7:01 pm said:
How to code template variables transform uppercase|lowercase?
I need to convert same variables to uppercase|lowercase|captalize.
/**
* @package ${1 default=Hello}
* @subpackage ${com}_${1 capitalize=false}
* @copyright Copyright (C) 2012 ${AtomTech}, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
defined(_JEXEC) or die;
How can I do this?
Reply
tiplite
on 07/09/2012 at 2:07 pm said:
Sorry but this is not available in netbeans
Reply
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API
Leave a Reply
Your email address will not be published. Required fields are marked *
Post Comment
Name *
Email *
Website
Comment
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API
Powered by WordPress and Foghorn

You might also like