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:
<?php 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 Home.page file in protected/page folder with the content:
<html> <body> <com:TForm> <com:TButton Text="Click me" OnClick="buttonClicked" /> </com:TForm> </body> </html>
and also file Home.php:
<?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 12:43 PM CEST #
Great post!
Would love to see full support for PRADO in NetBeans!
Posted by Jens-Martin on August 26, 2008 at 02:19 PM CEST #
Cool!
Anybody make a Zend Framework project yet?
Posted by Kevin Bond on August 27, 2008 at 07: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?
Thanks,
Petr
Posted by Petr on August 28, 2008 at 11:41 AM CEST #
Helo,
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 30, 2008 at 02:30 AM 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.
Regards,
Petr
Posted by Petr on August 30, 2008 at 06:27 PM 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 12:31 PM CEST #
Hi Eirik,
thanks for your comment. It looks like you have big experience with Prado. Is it right?
Regards,
Petr
Posted by Petr on September 01, 2008 at 01:18 AM CEST #
Hi Petr,
I guess I am asking both questions, both ZF setup and support.
-Kevin
Posted by Kevin Bond on September 02, 2008 at 05:25 PM 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.
Thanks,
Petr
Posted by Petr on September 02, 2008 at 06:29 PM CEST #
Message for oi:
The issue with defining type in the php doc for a class field is now fixed. http://www.netbeans.org/issues/show_bug.cgi?id=145692. I hope that it works for you.
Thanks,
Petr
Posted by Petr on September 03, 2008 at 03:08 PM 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 05, 2009 at 05:32 AM 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 30, 2009 at 03:10 AM CET #