Programming
Article

phpGroupware and XSLT

By Harry Fuecks

If you’ve been around PHP for a while you’ve probably heard of phpGroupWare, now in it’s fourth year (for PHP that’s old), according to Sourceforge.

As Dan Kuykendall recently commented here, phpGroupware, The Next Generation is in progress. I’ve managed to have at least one meaningful chat, via email, with Dan in past, while fighting the never-ending deluge, and he’s got some very interesting ideas on the use of XSLT.

For example, head to the demo of the next gen phpGroupWare and login (user: admin, pass: temppass). Surf around and enjoy some nice visuals. Now for the surprise – “View > Source” from your browser…. where’s the HTML? Assuming you’re using a recent version of Mozilla or IE, you should see an XML document. Up at the top you should find something like;


It’s actually your browser transforming the page to something that looks nice. For browsers without a built-in XSLT processor, Dan transforms the page to HTML on the server side, with PHP. Provides an interesting alternative to way templating is normally done in PHP and may mean faster page loading for users of newer browsers plus opens the way for REST based web services (side note Sitepoint are also employing a similar trick with their RSS feeds these days.)

Also interesting to note is the nextgen phpGroupWare is packing SOAP and XML-RPC interfaces, which offers further alternatives to accessing phpGroupWare, perhaps opening the way for an XUL client.

  • http://www.ajohnstone.com Andrew-J2000

    I took a unique approach to using XSLT on my own site. In fact the XSLT templates can run simply by opening the XSL Stylesheet itself, no base XML document required.

    The stylesheet was based on Cocoon and DocBook XSL Stylesheets. The way it works, is by using a default entry point to call a default template with a mode called ‘process.map’ once called it will search a cocoon ‘map:sitemap’ and perform a number of actions based on the XML document.

    Simply by passing a parameter or dumping an XML document as a parameter you can control an entire site within XSLT.

  • Aristotle

    Is phpGroupware affiliated with the phpBB Group? The phpGroupware layout is a slightly modified version of that used on phpbb.com. Just wondering.

  • Dan Kuykendall

    Nope, we are not affiliated with phpBB. At some point someone had liked the phpBB look and ported it to be a phpGroupWare theme. Of the themes in phpGW I liked this the best and so stuck with it.

  • pippo

    @Andrew
    I’m really interested about Cocoon,
    in particular this simple example is very interesting:
    http://cocoon.apache.org/2.1/howto/howto-html-pdf-publishing.html#Overview

    Do you use Cocoon 2.1 ?
    What hosting company are you using ?

    Thanks,
    :)

  • sylvain

    first : phpGW is a great tool : I love it !

    I think that XSLT is a great improvment if it provides a better isolation between the application logic and the presentation. I didn’t like the way the actual 0.9.16 version handles themes : multiple templates files for each theme seems too complicated to me. XSLT and gifs or png seems more simple to use. Only have to change the stylesheet and the theme is changed like in CSS.

    But I wonder why they didn’t try to use CSS instead of XSLT. Wouldn’t an appropriate set of CSS (one for the app, and one for the general theme for instance) be able to produce something quite similar in terms of design an server-side load decrease ?

    Sure, you might say that not all the browser support CSS, but is it really a problem ? Actually phpgw seems to be often used in environnements like enterprises where you can say to all the user to upgrade their browser (by the way, given firefox – and probably mozilla- supports png transparency, they could then give up the gifs).

    The other question i’d like to ask is about php5. phpGW seems to make a wide use of OO programming and soon XML-XSLT. Php5 seems more convenient to handle XML and is fully Object-Oriented. So my question is : is the phpGW team going to port phpGW to php5 ? which would seem logical to me.

    thanks.

Recommended

Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

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