Content last modified Tuesday 24 August 2021
hop to #bottom
Current version:
About It:
Get it:
Rate it:
  • Helpful?
  • 5 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!


Ease your job when inserting tags in your articles or site. Simply define virtual tags with your own custom functionality in them — other TXP tags, plugin tags, javascript, PHP, videos, whatever — and then invoke your new tags as normal with <txp:my_awesome_functionality />.


  • Define as many macros as you like
  • Define optional attributes for each, with default values if you wish
  • Insert attribute parameters into your macro definitions at runtime
  • Import / export macros for archive or sharing with the community
  • Macros can be single or containers

Here’s an example. You want to enable a client to display multiple category-based image galleries interspersed throughout their article with caption, author, filename and dimensions shown for each. You could instruct them on how to write a block of code to accomplish this (ouch!) or you could take the easy route and define a macro like this on their behalf:

<txp:images category="{img-cat}">
   <txp:image />
   <div class="img_info">
      <txp:image_info type="name" />
      (<txp:image_info type="w, h" break=" x " />)
   <div class="img_detail">
      <txp:image_info /> by <txp:image_author />

Name your macro client_gallery, then configure it to take one attribute called category and tell the plugin you will refer to it in your code as {img-cat}, then save it. That’s all there is to it.

All your client now needs to do is to put the following anywhere they wish in their articles to see a gallery:

<txp:client_gallery category="some_cat" />

and the given gallery will display. The advantages:

  1. simpler for your client
  2. you retain control over the formatting/output; if you want to change it to a lightbox script or wish to employ smd_gallery, just change the macro
Article Request Count:
Initially released:
16 Mar 11
Posted here:
16 Mar 2011

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