Content last modified Tuesday 24 August 2021
hop to #bottom
Categories:
Author:
About It:
Get it:
Rate it:
  • Helpful?
  • 1 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

txp_plugin_template

Textpattern plugins are perhaps best thought of as functions supplementary to those found in publish/taghandlers.php. Functions residing in this file respond to <txp:foo /> and <txp:foo>bar</txp:foo> tags found in pages, forms, articles and other dynamic templates in Textpattern.

A template for plugin distribution is available at:

txp_plugin_template.txt

Note that all the elements of the array must be filled in, and that the file must be saved as PHP, then opened in a browser to generate the encoded text which the Textpattern plugin installer can understand.

Quick notes on writing plugins

  • Whatever is returned by the plugin function will be output by the corresponding <txp:plugin_name /> tag.
  • The plugin function(s) has access to all the functions available to publish.php, including everything in /lib/. Further reference on these resources is forthcoming
  • If you would like to pass variables to the plugin function(s) via paramaters in the <txp:plugin_name /> tag, these will be passed as the first argument to the function as an associative array ($varname => $value).
  • If you would like to pass a variable to the plugin function by enclosing it in <txp:foo>bar</txp:foo>, this will be passed as the second argument to the function as a string.

Update 20 September 2004:

The plugin distribution template has been updated.

As of 1.0rc1, plugins no longer need to be installed via browser file upload from a text file. The base64 string that was previously passed to Txp via upload can now be simply pasted in to the plugin editing tab. This I believe removes some unnecessary clumsy steps.

For the next couple of releases, the depracated plugin file upload form will remain, but if plugin developers would be willing to release in the new format, that would be supah.

Since the question was posed above, the reason base64 is used to encode the (already seralize()’d plugin array) is; to allow for any linebreaks and other white space that might slip into the plugin distro. Base64 would be very forgiving, for example, to plugin code that was sent as email text.

The forum discussion (linked below) details the difference between the pre-rc (gamma 1.19) code and the RC 1 code.

Article Request Count:
Initially released:
2004-04-04
Posted here:
05 Apr 2005

You know you want to visit the Archives.
Published with Textpattern