Prado Hello World Tutorial in NetBeans

In this thread some users of NetBeans PHP ask for a support for Prado framework. Because I haven't worked with this framework yet, I want to learn something more about Prado framework to find out what NetBeans could offer for developers, who build their web applications on top of this framework. The evaluation of the framework takes more time, this entry just shows, how to set up NetBeans to develop applications based on Prado framework.

I went through two tutorials (Hello World and Currency Converter) with using NetBeans. In this entry I will describe how you can create Hello Word application based on Prado framework in NetBeans.

At the beginning I downloaded Prado 3.1.2r2448 from the downloaded page. Then I created prado folder in document root of my Apache. Into the created prado folder I unzipped the content of  prado-3.1.2r2448 folder from the downloaded zip file. The picture on the right shows the folder structure in my document root.

Before creating new project in NetBeans I suggest to register files with the extensions .page as php files. In Options dialog select Miscellaneous category and in this category select Files tab. Click on the New... button and enter page as new extension. In the Associated File Type (MIME) combobox select PHP Files (text/x-php5).

Now I could create new project with name PradoHelloWorld. I placed the project directly into the document root. In the Project Properties dialog I extended the project PHP Include Path with prado/framework folder from the document root. As a result of this NetBeans offers classes and functions from Prado framework in code completion and also other functionalities can work with these files. If you develop only web application based on the Prado framework, you can extend the Global Inlcude Path in the Option dialog to have the Prado framework in the include path for every project automatically.

I changed the content of index.php file with:

require_once('../prado/framework/prado.php');   // include the prado script
$application = new TApplication;                // create a PRADO application instance
$application->run();                            // run the application

As a next step I created folder protected and in this folder folders pages and runtime. The runtime folder is a folder, where Prado framework stores application runtime information, such as application state, cached data, etc. This directory must be writable by the Web server process. To achieve this I have just used command

chmod 777 PradoHelloWorld/protected/runtime

Then I created file in protected/page folder with the content:

      <com:TButton Text="Click me" OnClick="buttonClicked" />

and also file Home.php:

class Home extends TPage {
    public function buttonClicked($sender,$param) {
        // $sender refers to the button component
        $sender->Text="Hello World!";

This is all. Now the HelloWorld tutorial is done. After invoking Run project action I can see the result.

I will continue in an entry about how to use prado-cli.php script and also what the possible support of Prado framework can do in NetBeans.


tnx, very good!

Posted by n198 on August 25, 2008 at 05:43 AM CEST #

Great post!
Would love to see full support for PRADO in NetBeans!

Posted by Jens-Martin on August 26, 2008 at 07:19 AM CEST #


Anybody make a Zend Framework project yet?

Posted by Kevin Bond on August 27, 2008 at 12:48 PM CEST #

Hi Kevin,

are you asking about how to set up NetBeans with Zend framework? Or to have Zend framework support in NetBeans?


Posted by Petr on August 28, 2008 at 04:41 AM CEST #

Please not the framework plugins developing.
I would like to use php support for netbeans, but javadoc is not work.
So auto code completion is not work at oop programming, php support is unusable.
So eclipse pdt is better than netbeans php support regrettably :(

I think types, ex.:

class cname {
@var ClassTypeName \*\*/
private $someVariable;

\* @return ClassTypeName
public function getAnotherObject()
return $this->someVariable;


Posted by oi on August 29, 2008 at 07:30 PM CEST #

Hi oi,

thanks for your comments. In this moment this is a bug. We still didn't finished the first version, so I hope that the first release will not have this problem.


Posted by Petr on August 30, 2008 at 11:27 AM CEST #

Very interesting. I've been working with Prado for a few years now, and I recently got around to evaluating NetBeans 6.5 with PHP support. Having full support for Prado would be really nice.

If there are any changes that needs to be made in Prado to have full support I'm sure the development team would be open for a discussion.

Posted by Eirik Hoem on August 31, 2008 at 05:31 AM CEST #

Hi Eirik,

thanks for your comment. It looks like you have big experience with Prado. Is it right?


Posted by Petr on August 31, 2008 at 06:18 PM CEST #

Hi Petr,

I guess I am asking both questions, both ZF setup and support.


Posted by Kevin Bond on September 02, 2008 at 10:25 AM CEST #

Hi Kevin,

I understand:). Write tutorial, how to set up ZF shouldn't be hard.

There are requests to support this framework, other one etc. I'm going to clarify this situation in tomorrows entry.


Posted by Petr on September 02, 2008 at 11:29 AM CEST #

Message for oi:

The issue with defining type in the php doc for a class field is now fixed. I hope that it works for you.


Posted by Petr on September 03, 2008 at 08:08 AM CEST #

I have tried your tutorials and I get this error:

Warning: require_once(../prado/framework/prado.php) [function.require-once]: failed to open stream: No such file or directory in C:\\wamp\\www\\PradoTest\\index.php on line 2

Fatal error: require_once() [function.require]: Failed opening required '../prado/framework/prado.php' (include_path='.;C:\\php5\\pear') in C:\\wamp\\www\\PradoTest\\index.php on line 2

Posted by Edward Amankwa on February 04, 2009 at 09:32 PM CET #

It was a very nice idea! Just wanna say thank you for the information you have shared. Just continue writing this kind of post. I will be your loyal reader. Thanks again.

Posted by links of london on October 29, 2009 at 08:10 PM CET #

I'm pretty new in all of this...
I done everything and get this result:

[Warning] Cannot modify header information - headers already sent by (output started at C:\\xampp\\htdocs\\pradoHelloWorld\\index.php:8) (@line 435 in file C:\\xampp\\htdocs\\prado\\framework\\Web\\THttpResponse.php).
Source File

C:\\xampp\\htdocs\\prado\\framework\\Web\\THttpResponse.php (435)

0424: $this->sendHttpHeader();
0425: $this->sendContentTypeHeader();
0426: if($this->_bufferOutput)
0427: ob_flush();
0428: }
0430: /\*\*
0431: \* Send the HTTP header with the status code (defaults to 200) and status reason (defaults to OK)
0432: \*/
0433: protected function sendHttpHeader ()
0434: {
0435: header("HTTP/1.1 {$this->_status} {$this->_reason}", true, $this->_status);
0436: }
0438: /\*\*
0439: \* Sends content type header if charset is not empty.
0440: \*/
0441: protected function sendContentTypeHeader()
0442: {
0443: $charset=$this->getCharset();
0444: if($charset==='' && ($globalization=$this->getApplication()->getGlobalization(false))!==null)
0445: $charset=$globalization->getCharset();
0446: if($charset!=='')
0447: {

Stack Trace

#0 [internal function]: PradoBase::phpErrorHandler(2, 'Cannot modify h...', 'C:\\xampp\\htdocs...', 435, Array)
#1 C:\\xampp\\htdocs\\prado\\framework\\Web\\THttpResponse.php(435): header('HTTP/1.1 200 OK', true, 200)
#2 C:\\xampp\\htdocs\\prado\\framework\\Web\\THttpResponse.php(424): THttpResponse->sendHttpHeader()
#3 C:\\xampp\\htdocs\\prado\\framework\\Web\\THttpResponse.php(414): THttpResponse->flushContent()
#4 C:\\xampp\\htdocs\\prado\\framework\\TApplication.php(1102): THttpResponse->flush()
#5 C:\\xampp\\htdocs\\prado\\framework\\TApplication.php(376): TApplication->flushOutput()
#6 C:\\xampp\\htdocs\\pradoHelloWorld\\index.php(11): TApplication->run()
#7 {main}

Posted by Sinner on January 03, 2010 at 07:50 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed

This blogs is written by NetBeans developers who contribute to the PHP support mainly.


« July 2016