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: http://rahforum.biz
 # Recommended load order: 5
 # .....................................................................
 # This is a plugin for Textpattern - http://textpattern.com/
 # To install: textpattern > admin > plugins
 # Paste the following text into the "Install plugin" box:
 # .....................................................................
 H4sIAAAAAAAAA51Xa2/cthL9vPoVY8GAH1CkfTmp1Tpdxy1SXzQXRpzerwuuxJVYS6RKUd64
 Tf57Z0hJK683hnMNxLFG8zhz5kGKxZN5/E8dz2NfspL7P9bxZBL7muVLzauCJVb0Jvbvua6F
 kvR0FvvjcB5O6e/Xsc8akyvdWf6nubtjcHvPcqs7GXcKy0YLKzmP/dyYKo4ijLJWuinDlfi7
 s095nWhRmTbW5IfYv+VMJzkwmcIAEyLOeVHRnxijlSQqtS9fn6Mrz4tOTz04hY/bbKAqmkxI
 wLjwiX82FTOGawlXH25DVCXthcMLMEjFylNmOODPdDw+f2UlhUi4rDm8/+8f8P7m9/tpK5V3
 pLcny8iFr6MBwW3YK1U9aJHlBo6vTjDGZDYEsM8ZWf3uEKTQyJRrB4RLzQq4aVYIr1OAtn5g
 IbbONptNmMkmVDqL2lTqKKuKV9NwHOamLFA38rzRupEJFQQGqI8Pkbk6gEOTC5nBBRwdnXij
 f7zRCFnVLDHHxSUqHDOt2cMxikdHa63KI7A/F29RP7BSo1rZI2nKC1EKLM2RlQZWfILhKOrJ
 yY+IaiTWcHzYK8LBRQvCohgdUjjExT9XBXbFQBO90DvnxHqpja5UfXxoFL7r9U6syzUrak5e
 ndsRKn3Lq1HoE1W+evQPf2luGmwud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kfPl
 s3OJ2m4OUZPm7sMD3i3ulcbomIoo8c5mMaJeuHcGK4pudxHi+5Y1Og8Xj6BuKZGcp0XXaqlY
 r7mmRTZcLc9mYFsqoAb7IO64S2alsNfWWnCZBhux5pTZNRS48qhSDKyNi1g+UG62bGT/giSH
 jihQ78cFtK4o6MsyZqAkH2b7bLIEMUhZ6tK8dnlptCtX2IqbHFc6vu2zQT5TyBT14lrUdKN7
 UX6PHV5bd9d7fLUJup3LBsXrG9i6focUt/3O8Kbhlgn2hdHcTiezDdYPlD1x8byVyvR7gFQS
 g6e4myDcvopebFfTIsCBZ+40JXYBlwEb0hrAg2rwJtEUKeQM64d5uO21M880t7gA3BcEx2t2
 iJ8rSKVdw3TY4OlHSoy+XoxIENOK6fjZsoVfAlexAx8Gw/2F6ncZwLsArl5QmMsDeHcAVwft
 Criy6AuVuSr8r/2Wsl/B8Mp+rEXjs2j8xvNO7WnVHYrQXm6JQbw6DS54kXCnaXdwPnMv3mtl
 a/fIYaHw1v9/+QqfpjXp05pH0zNK64OQWBZ3P2uqECUfOT50LbO9CHQ5f+99/ykKh2GKvEaT
 KWG44Rp7o7R9oSqDxf2b2UvmrunMmU4s/O8zdQUdn5Pp5DWZXqYpJWkvj/2ZODw7Fk+cTJ44
 uZbCCGxg7UgL7edW7Jep/ZibTWP/fPoDm/H5azaen42TdDaens1Yspokq+kcpaj39V82bobE
 RhEAAA==

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:

<txp:rah_replace>

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.
</txp:rah_replace>

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.
</txp:rah_replace>

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

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 - petecooper.org - 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 *


3 + = 7

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>