Open Source Software Blog. Top Wordpress widgets & plugins

What’s this? XMLPAD plugin for wordpress syndicate PAD file in wordpress.
REQUIREMENTS

To run xmlPad you will need WordPress 2 or greater and PHP 4.3.0 or greater.

INSTALLATION

You can download it here (xmlpad).
The installation process is very simple and no special steps are needed.
Drop the “xmlpad” directory into the “plugins” directory in WordPress.

The “xmlpad” directory should now contain the files “xmlpad.php”, “reader.php”,
“config.php”, “template.php”, “readme.txt” and the “cache” directory. The cache
directory must be writeable by web server user. If you are new to linux these
commands will help you to give proper permissions to cache directory:

cd xmlpad/directory
chmod 755 cache
chmod 755 cache/img

In the “Plugins” section of “Site Admin”, click “Activate” adjacent to
“xmlPad”. Everything is done! Now you can use your xmlPad plugin for WordPress.
USAGE

Insert “[xmlpad:URL]” into the post and replace “URL” with the URL of the
XMLPAD file location. Choose “Save” and look at your post. The first time
it loads the xmlPad plugin will try to get information from remote file
and cache it in the local directory. The images used by xmlpad file will
also be cached.

CONFIGURATION

You can find the most common setting in the config.php file. Let’s look
at it a bit closer:

$config['cache_lifetime'] – the number of seconds the cache is valid

$config['encoding'] – you can change the output encoding of xmlpad plugin
to that your blog uses

$config['dateformat'] – there are a lot of date fields in xmlpad file and
you can set your own date format

$config['relurls'] – should we use absolute or relative paths for cached images.
The default value is false.

The most interesting settings are located in $config['fields'] variables. The
second key in this associative array is the name of xmlpad field caption and
value is the path to element in remote xmlpad file. For example the line

$config['fields']['Program name'] = ‘program_info/program_name’;

tells plugin to read data from “program_info/program_name” xml node and give it
“Program name” caption in the output. You can also add separators to the output
by adding special record to configuration file. Here it is:

$config['fields'][] = ’sep’;

Try to experiment with configuration file and you will be able to fully customize
the plugin output.

If you need to change the appearance of xmlpad output you can take a look at
template.php file. It’s responsible for output formating. This file is very
small and it’s easy to understand the logic behind it. Just plain php, nothing
more.

NOTES

The cache time is set to 24 hours by default, so changes to the remote xmlpad file
may not show up immediately. You can set cache time to whatever you want in the
configuration file as described above. To clarify the cache you need to remove all
files from “cache” except “img” directory.

If you want to change the output encoding you’ll need iconv php extension to be
installed.
Example for http://www.simplysup.com/padfiles/trpad.xml :

  

[xmlpad:http://www.simplysup.com/padfiles/trpad.xml]

  

October 10th, 2006 at 8:39 pm | Comments & Trackbacks (3) | Permalink