Textpattern

Return to main site

Related

Frequently Asked Questions

Can I use tags within tags?

Q.

Can I use one tag as the attribute to another tag?

A.

Textpattern supports nested tags—that is, enclosing one tag within another. For example, from the default article form:

<txp:permlink><txp:title /></txp:permlink>

However, it’s not possible to use one tag as an attribute for another. The following will not work:

<txp:article_custom section="<txp:s />" />

If you need to use a dynamic value as a tag attribute, the best way is to call the tag handler function directly, like this:

<txp:php>
echo article_custom(
array('section'=>$GLOBALS['pretext']['s'])
);
</txp:php>

The first argument to the tag handler function is an associative array representing the tag attributes.

Posted 2 January 2006, 01:51 by Alex Shiels

---