====== php_dhtml - A DHTML Graphical User Interface ====== ===== Quick links ===== * [[documentation]] * [[:downloads]] * [[TODO]] ===== 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'. {{ php_dhtml:winapp_about.png?200 |A Windows-like application made with php_dhtml and winApp}} ===== Summary ===== ==== Goals ==== * Client application developpement using PHP * Quickly create friendly user interfaces * Applying Web developement techniques and knowledge to Windows client scripting ==== Benefits ==== * HTML based display, so reusing code from Web based project is possible. * Very simple API (easy to learn) * Even driven architecture (an event can be a "close" event on the window or a "click" event on an HTML tag) * HTML code modification at runtime (ala Javascript) ==== Drawbacks ==== * The control is an embeded "Internet explorer" so you may be dependent of local Internet configuration. * Initialize MFC on load (dl), so you may experience an important (~1 sec) delay at startup. ===== 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 better ((maybe with COM/DOTNET extensions ?)) (and you're probably right ;-)). This approch has some advantage: * the php_dhtml code is simple * COM programming is painful and bug prone * it's already working and I need it :-) ==== 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: - The target audience platform - The developement team - 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: [[http://gtk.php.net/|PHP-GTK]]. Otherwise if the answer is "Windows only", well you have at least 2 more choice: [[SF>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 [[SF>Winbinder]]. And of course you can use both. ==== About the DHTML Control ==== The core of php_dhtml is an [[MSDN>CDHtmlDialog::CDHtmlDialog|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: '''') or by a single element defined by it's HTML id (ie: ''''), 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 ([[misc:dhtml_software#help_center|Help Center]] & [[misc:dhtml_software#User managment|User managment]] in Windows XP, [[misc:dhtml_software#new_project|New project]] dialog in VS.NET). And many companies use it for their products, the well knowns [[misc:dhtml_software#ZoneAlarm|ZoneAlarm]] and [[misc:dhtml_software#NortonAV|NortonAV]] of course but many other companies choose it for their enterprise projects. ===== Screenshots ===== You can click on the screenshot to see the code. * This ones are attractive screenshot of application made with the [[php_dhtml:winApp class]]. [[exemple3|{{php_dhtml:winapp_menu.png?300|A classic winApp showing an about box}}]] [[exemple4|{{php_dhtml:wiki_editor.png?300|A Wiki editor}}]] [[exemple5|{{php_dhtml:marienbad.png?300|A Marienbad game}}]] * Simpler [[exemple2|example]] made with the [[dhtml class]] [[exemple2|{{php_dhtml:exemple2.png}}]] * Simpliest [[exemple1|example]] made using the php_dhtml API [[exemple1|{{php_dhtml:php_dhtml_exemple.png?300}}]] ===== Installation ===== php_dhtml is a PHP extension. Please look at the [[php>docs.php|PHP documentation]] for more info on enabling a third-party extension. * [[:downloads]] ===== License ===== The currrent version of php_dhtml is licensed under the [[http://www.gnu.org/copyleft/lesser.html|LGPL 2.1]]. ===== Other GUI software for PHP ===== * [[SourceForge>WinBinder]] (Win32) * [[http://gtk.php.net|PHP-GTK]] (X-platform) * [[SourceForge>PHP-Tk]] (*nix)