Table of Contents

php_dhtml - A DHTML Graphical User Interface

Quick links

What is it

php_dhtml is a Graphical User Interface (GUI) for PHP that works on Windows platform.

It allows to control a DHTML Window (Understand: an Internet Explorer Control running in an MFC thread). You can control all the aspect of the Window (size, position, …) and control the behavior of the DHTML Control (loading HTML pages, receive browsing requests, …).

Imagine you can receive in your PHP code Javascript events like onMouseOver and/or decide to change the content of a div the way you do it using the Javascript method ‘getElementById.innerHTML’.

A Windows-like application made with php_dhtml and winApp





How does it work

On extension loading from Php, the MFC core is loaded, when you request the creation of a DHTML Window an MFC thread is created that will handle the window. To interact with the window you can get/set properties on it, internaly thread messages are used.

You may think that loading MFC in PHP is evil for some reasons, and that doing the interaction using COM could be better1) (and you’re probably right ;-)).

This approch has some advantage:

When do you need php_dhtml ?

When you need to create client apps with PHP you have a number of questions to ask before you choose a GUI:

  1. The target audience platform
  2. The developement team
  3. The application type

First of all, if the answer to (1) is: “multiple” so you really don’t have the choice, you have to use the only multi-platform GUI available for PHP: PHP-GTK. Otherwise if the answer is “Windows only”, well you have at least 2 more choice: Winbinder or php_dhtml.

Chance are that if you have selected PHP as a scripting engine for your project it’s because your team (maybe just you) is experienced with it and you have a small project to handle. So in this case I bet that you probably have a group of person (or a single person) that master PHP and HTML. In this case you should consider using php_dhtml, since you can build rich client apps using well-known Web developement techniques.

Althougt, if your project goal is to get rid of common limitations of HTML controls/widgets you will probably need to have a look at Winbinder. And of course you can use both.

About the DHTML Control

The core of php_dhtml is an MFC DHTML Control. It is present since early versions of MFC but since version 7 it allow the definition of events that may be thrown by a particular class of element (ie: <tag class=“click_able”>) or by a single element defined by it’s HTML id (ie: <tag id=“a_click_able_element”>), and most of all it allow to dynamically change the content of an HTML tag by it’s id.

Many commercial projects make use of the DHTML control (using C#, C++ or VB). Microsoft itself use that control to handle most of their new Dialog box and apps (Help Center & User managment in Windows XP, New project dialog in VS.NET). And many companies use it for their products, the well knowns ZoneAlarm and NortonAV of course but many other companies choose it for their enterprise projects.


You can click on the screenshot to see the code.

A classic winApp showing an about box A Wiki editor A Marienbad game


php_dhtml is a PHP extension. Please look at the PHP documentation for more info on enabling a third-party extension.


The currrent version of php_dhtml is licensed under the LGPL 2.1.

Other GUI software for PHP

1) maybe with COM/DOTNET extensions ?
  php_dhtml/index.txt · Last modified: 2005/02/13 13:10
Recent changes RSS feed Powered by PHP Driven by DokuWiki