By Harry Fuecks

Generating XUL with PHP

By Harry Fuecks

Couple of interesting PHP / XUL projects I ran into recently, experimenting with XUL generation from PHP.

First there’s a PEAR package going through the process of approval (here): PEAR::XML_XUL. This provides a DOM-like PHP API for generating XUL. Not sure how much mileage there is in that approach through; will it add much value over simply generating the XUL using strings (or templating), as is common with HTML.

Fascinating is HV WDDX Metadata, over on phpclasses (you’ll need your own account to view the code). This seems like a more promising approach. If I’ve understood it correctly, uses WDDX (a widely XML format for serializing data) to define the “widgets” which appear in an XUL form, as well as the JavaScript used to validate them on the client side. Generation is being done with XSLT in the provided example. In other words you’d just need to modify the original WDDX document to add further fields / validation to an XUL form.

Nice to see XUL being explored by PHP developers. Any more projects out there?

Other XUL news is XULPlanet now has a PHP-manual-like comment system for some of the online references and tutorials.

  • Bummer.. — looks like someone tried to do a pear XUL class, but it’s not maintained or developed anymore.. I’m seeing this more and more on PEAR.. Projects just flapping in the wind. Its very depressing.

    I was very disenchanted with Pear::Cache was abandoned.

  • Brett

    Xajax includes in its download a sample XUL file for which Xajax (essentially all PHP creating AJAX or other JS) can be used to handle the Javascript. This would generate AJAX from the server.

    If you wanted to connect your XUL to a remote PHP file, on the other hand, this is explained here (though you might be able to do this by writing it first with Ajax).

  • Brett

    The real question for me though is when PHP can be fully included as a kind of plugin to Mozilla so that one can simply write all Javascript code in PHP (or at least Xajax working on the client side) so that one could write applications which get access to the filesystem, but without needing to learn a whole new language to do so.

  • Brett

    Oops…I see you are the one who wrote the file above (thought your name was familiar)… :) Anyways, you still may be interested in the Xajax aspect… :)

Get the latest in Front-end, once a week, for free.