||This page or section is an undeveloped draft or outline.
You can help to develop the work, or you can ask for assistance in the project room.
Back to PHP
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.
What is 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.
Example PHP-GTK Program
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 to close it using the normal means.
<?php $window = new GtkWindow(); $window->show_all(); gtk::main(); ?>
This is a little more complex than your usual Hello 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:
displays the newly created window.
The last line:
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+ program run.
- PHP GTK Forum lots of GTK related topics
Authors Note: This chapter is still un-done. More will be coming later.