Content last modified Monday 5 September 2016
hop to #bottom
Current version:
About It:
Get it:
Rate it:
  • Helpful?
  • 5 Yes
  • 0 No
Flag it:
Contact Reason [ ? ]


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
Article modified:
19 Feb 2012

If there is a comment form at the Information URL, you may want to leave your comments/questions there or at the Forum thread for quicker feedback. Otherwise, comment away:

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Commented (1)

To make it really simple for a client wouldn’t it be great to have a button in the write tab for new articles that could include such a macro easily?

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

You know you want to visit the Archives.




There are also tag clouds, 'cause those are fun.