Installing and Using a Textpattern Plugin

Textpattern CMS has the capability to have its functions extended by applying plugins. These plugins are typically made available for download and are applied to Textpattern via the administration panel. In this post, I’m going to show you how to install and use a Textpattern plugin.

The plugin I’m using is called rah_replace and it was written by Jukka Svahn, one of the core Textpattern developers. This plugin is an excellent example of not including functionality in the core code because only some users will need it, and keeping the core code efficient is important. A plugin typically presents itself to the administrator as plain text. The current version of rah_replace looks like this:

 # Name: rah_replace v0.4.2
 # Search and replace
 # Author: Jukka Svahn
 # URL:
 # Recommended load order: 5
 # .....................................................................
 # This is a plugin for Textpattern -
 # To install: textpattern > admin > plugins
 # Paste the following text into the "Install plugin" box:
 # .....................................................................

This block of text allows straightforward copy and pasting into the browser. When the code above is applied to the administration panel, it is decoded into Textpattern-readable PHP code.

In the Textpattern administration panel, go to Admin, then Plugins. You will be presented with an empty text box. Paste the code into the text box and click Upload. Next, you’ll see how the block of text is decoded into PHP. Click OK to confirm. The plugin is now installed, but not enabled. You will be taken back to the Plugin sub-tab and have the option to enable and edit the plugin, see who wrote it, and get help. The logic behind the decision to not enable a plugin instantly on it being installed is that changes may need to be made prior to enabling; for example, a language string might need localising.

Click No to enable it. This may seem counter-intuitive, but you’re toggling the No to a Yes. To disable it, click Yes. When the plugin is enabled, you can start to use it.

A plugin may bring with it new Textpattern tags. In the case of rah_replace, it introduces this container tag:


Note the ‘txp’ to identify it as a Textpattern tag, and also the three characters before the underscore which identify Jukka as the author. Essentially, rah_replace works by searching for provided strings and replacing them with other provided strings. Here’s a rudimentary example:

<txp:rah_replace from="cat" to="dog">
 The cat sat on the mat.

Textpattern will parse the code above and replace instances of cat with dog, ultimately outputting the following:

The dog sat on the mat.

You can take this further. Here’s another example:

<txp:rah_replace from="cat,mat" to="dog,box">
 The cat sat on the mat.

Instances of cat will be replaced by dog, instances of mat will be replaced by box, like this:

The dog sat on the box.

Because the tag is a container, other tags may be used in place of the text in the example above. It’s possible to get a bit crazy with tags, perhaps having a single tag wrapped inside a container, which in turn is wrapped inside another container. The sky’s the limit!

Each plugin provides help by way of examples, usually with an accompanying website. Additionally, each plugin usually has a forum thread on the Textpattern forums for specific questions and troubleshooting.

This is a short overview of how a Textpattern plugin can be installed and used. I will cover more advanced techniques in future articles. I hope you’ve found this article useful or helpful, and I look forward to seeing you again soon.

Looking for quality Textpattern Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , , | Posted under Textpattern | RSS 2.0

Author Spotlight

Pete Cooper

Pete Cooper has been using Textpattern since 2005. Textpattern is his preferred CMS weapon of choice. Its logical and flexible approach to content management makes Pete happy, as does its lightweight core and helpful user community. Pete's website - - runs on top of Textpattern and chronicles his day-to-day experiences from his home near the Atlantic in north Cornwall, United Kingdom.

Leave a Reply

Your email address will not be published. Required fields are marked *