Building a Desktop CMS Client using PHP-GTK
Presentation Slide: OSCOM4_DH_DesktopClient.pdfSpeaker:
David Heath
Web Application Developer
OneWorld.net
Introduction
OneWorld.net is a multi-lingual web portal with editorial offices around the world, including in Lusaka, Zambia and New Delhi, India. Use of our web based CMS hosted in London, UK is often made difficult by poor quality internet connectivity in those regions. To overcome these problems we built an “offline client” for our CMS using PHP-GTK. This presentation will give an explanation of the design choices, technologies and practicalities involved in building this client.
Target audience/goals for this session
This talk will be primarily aimed at developers. It may also be of interest to business managers interested in learning about a practical case study of building a desktop client for a CMS. General programming knowledge, and familiarity with RDBMS and internet technologies will be assumed. No knowledge of GTK or PHP will be assumed.
Goals of talk:
- Introduction to PHP-GTK will be primary goal.
- Demonstration of practicality of using PHP-GTK to build a CMS client
- Introduction to how other technical pieces fitted into the solution (Sqlite, XML-RPC, Rserv, libCurl, Nullsoft installer)
Outline of talk
Introduction (5 mins)
Design goals (5 mins)
Overview: summary of the offline client requirements
must haves:
- cross platform: linux and windows
- lightweight and easy to install .. ideally a single installation package on windows
- keep synchronized with content changes to the remote database
- be able to create articles whilst offline for later submission (similar to an email client)
- must communicate with our online CMS which comprises:
- heavily customized ezpublish 2.2 from eZ Systems, Postgresql database
- resumable downloads
- only needs to submit articles, don't need to edit existing ones
- we know and like PHP!
- if possible, re-use code from our online CMS, e.g. data objects
Technologies involved (10 mins)
Overview: what technologies did we choose and why?
- central web based CMS:
- based on heavily customized ezpublish 2.2 from eZ Systems (www.ez.no)
- postgresql
- offline client
- PHP-GTK, Glade for user interface (php 4.3, PHP-GTK 1.0)
- Sqlite for data persistence on the client
- XML-RPC for client-server communication
- customized version of Rserv from Postgresql contribs
- Nullsoft Scriptable Installer for Windows installation package
Practicalities (15 mins)
Overview: how did we put it into practice? Show some source code/demos.
- PHP-GTK documentation is somewhat patchy, so the first few weeks of development were quite painful!
- But, we gradually figured it out ... most things make sense
- Glade helped get something tangible up pretty quickly
- Remote synchronization also involved quite a lot of effort. Rserv ported from Perl to PHP. Added schema dumping functionality to perform the initial population of Sqlite DB.
- A few compatability issues with Sqlite .. (fixed in latest version).
$res = $db->query(“Select foo.bar from foo”);
print_r($res);
/* will output:
array (
“0” => 1,
“foo.bar” => 1
);
*/
ie. column name is qualified with “foo.” which is not expected.
print_r($res);
/* will output:
array (
“0” => 1,
“foo.bar” => 1
);
*/
ie. column name is qualified with “foo.” which is not expected.
Conclusions /Q&A (10 mins)
- PHP-GTK allows rapid development
- GTK bindings exist for many other languages, see http://www.gtk.org/bindings.html
- PHP 5 will bring bindings for GTK2
Web links to documentation, tips etc including source code for OneWorld’s Offline Working Tool (GPL) will be made available.
