Using Paloose with WordPress

Paloose can be used alongside WordPress to enhance the capability of both. WordPress is a popular application for the Web to produce blogs and general websites. It provides considerable hooks to extend it, both thematically and functionally. Paloose provides a means of adding to WordPress complex XML processing based on the Cocoon approach.

Until the plugin is loaded onto the WordPress site (which will happen when it has been fully tested) the following instructions are for those who want to try the plugin and are happy to load the latest version here and install it manually.

Please use at your own risk as this is a very beta version. More documentation is in preparation

There are several approaches to running the Paloose Plugin. These vary from the "get me running as quickly as possible", through the "I have already got a Paloose Server installed" to the "I need speed from the Paloose system". For an example of using this plugin see the example here.

Install with no existing Paloose system

Download the latest version here. The download includes the latest Paloose and its compact version together with the latest Log4PHP that Paloose will work with. The directory structure of the plugin is:

paloose ----- log4php <-- Log4PHP subsystem | |-- paloose-system <-- Full Paloose system | |-- paloose-compact-system <-- Compacted Paloose system | |-- paloose-admin ----- options.php | |-- paloose-includes ----- functions.php | |-- paloose-scripts ----- palooseAdmin.js | |-- paloose-styles ----- palooseAdmin.css | |-- paloose.php <-- paloose plugin hook | |-- readme.txt <-- documentation for plugin

This complete directory should be put in the WordPress plugins directory (wordpress/wp-content/plugins). I intend to include in the WordPress plugin site as soon as I am happy it can be released. It will then be available on the WordPress dashboard:

(The version number and other details may be slightly different). When the plugin is then activated it should appear in the setting menu of the Dashboard:

Selecting the plugin will show a set of options to configure your site's local conditions. In general you will not have to change these for a simple installation. In a system that includes the paloose system (full, compact and logging) the typical values for the configuration variables are:

  1. Directory where the paloose subsystem is stored — "../paloose-system" (change this to "../paloose-compact-system" to use the more efficient but no logging version of Paloose).
  2. Directory where the XML documents are held that Paloose uses — "[base directory path of your XML repository]".
  3. File (and path) where the Logger configuration information is stored — "[File name and path of your log4php lagging configuration]".
  4. Directory path where the log4php code is stored — "../log4php".

All other parameters can be safely ignored or adjusted to suit local conditions: cache directory, root sitemap. These should remain the same regardless of whether you have an existing Paloose server fitted.

Install with existing Paloose server

There are occasions where you may need to have a Paloose server as well as a WordPress system working at the same time. In this case the server installation of Paloose can be used instead of the version in the plugin directory. Although you do not have to, you can removing the Paloose system in the plugin directory (paloose-system) and its compact version (paloose-compact-system). The 4 variables defined above must be changed to reflect the path of your existing Paloose installation.

Using the Paloose WordPress plugin

The plugin is called from a template file using the following syntax:

<?php echo paloose( [uri path string], [query string] ); ?>

where

For example if the template has the following line

<?php echo paloose( 'concerts.html', $_SERVER[ 'QUERY_STRING' ] ); ?>

and if the calling URI is http://<localhost>/concerts.html?year=2010, the following pipeline would match and the request parameter concertYear would be set to "year=2010".

<map:match pattern="concerts.html"> <map:generate src="context://content/data/concerts.xml" label="concerts-content"/> <map:transform src="context://resources/transforms/extractConcerts.xsl"> <map:parameter name="who" value="{request-param:concertYear}"/> </map:transform> <map:serialize type="xml"/> </map:match>

The original calling line would be replaced by the XML (XHTML) returned from Paloose. Note that the serializer must be XML not XHTML as Paloose returns a XHTML scrap, not a full HTML document.

Copyright 2006 – 2023 Hugh Field-Richards. All Rights Reserved.