| PHP Programming PHP-GTK | Daemonization |
This page or section is an undeveloped draft or outline. You can help todevelop the work, or you can ask for assistance in theproject room. |
Back toPHP
As you should have already learned in previous sections of this book. PHP is more than just a web server language. It can be used to create GUI applications, shell like scripts, and even daemons, among other things. This chapter focuses on using PHP to create GUI applications using PHP-GTK.
PHP-GTK is a GTK+ and GNOME language binding for PHP. That's just a fancy way of saying that PHP-GTK makes it so that GNOME and GTK+ programs can be written using PHP.
You have to have PHP-CLI and GTK installed on your box.
For questions, search or browse thisPHP GTK Forum hosted byNabble.
Below is a very simple PHP-GTK program. It just creates a window that doesn't do anything. In fact, as you'll find out if you run it, this window won't even close if you try toclose it using the normal means.
<?php$window=newGtkWindow();$window->show_all();gtk::main();?>
This is a little more complex than your usualHello World program. But we'll go through it step by step.
The first line:
$window = new GtkWindow();
creates a new GTK+ window. One thing to note about GTK+ and GNOME programming is that when you create a window it does not automatically get displayed. (That's what the next line does.)
The next line:
$window->show_all();
displays the newly created window.
The last line:
gtk::main();
is where all the magic happens with GTK+. For now, just take my word for it that you need to call this to make you GTK+ programrun.
Authors Note: This chapter is still un-done. More will be coming later.
| PHP Programming PHP-GTK | Daemonization |