PHP-GTK
From Openmoko
(Added a "Hello World example".) |
|||
| Line 3: | Line 3: | ||
[http://gtk.php.net PHP-GTK] is an extension for [http://php.net PHP], which enables you to write real applications with a GTK-interface. This works really well on the OpenMoko, and some applications has already been written. | [http://gtk.php.net PHP-GTK] is an extension for [http://php.net PHP], which enables you to write real applications with a GTK-interface. This works really well on the OpenMoko, and some applications has already been written. | ||
| + | |||
| + | |||
| + | == Hello World example == | ||
| + | <?php | ||
| + | dl("php_gtk2.so"); | ||
| + | |||
| + | class MyWindow{ | ||
| + | function __construct(){ | ||
| + | $this->window = new GtkWindow(); | ||
| + | $this->label = new GtkLabel("Hello world"); | ||
| + | $this->window->add($this->label); | ||
| + | $this->window->show_all(); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | $my_window = new MyWindow(); | ||
| + | Gtk::main(); | ||
| + | ?> | ||
Revision as of 12:32, 4 February 2009
What is it?
PHP-GTK is an extension for PHP, which enables you to write real applications with a GTK-interface. This works really well on the OpenMoko, and some applications has already been written.
Hello World example
<?php
dl("php_gtk2.so");
class MyWindow{
function __construct(){
$this->window = new GtkWindow();
$this->label = new GtkLabel("Hello world");
$this->window->add($this->label);
$this->window->show_all();
}
}
$my_window = new MyWindow();
Gtk::main();
?>
How to get it?
Derick Rethans has ported PHP and PHP-GTK for the OpenMoko, which you can read more about on his blog in this post.
There has already been set up a repository called Knjrepository by Kasper Johansen, which includes these packages amongst many others.
