adi_globals – Global variables

This is designed to make getting hold of TXP globals a little easier.

Usage

Just specify the variable you’re interested in & adi_globals will find it & return it’s value.

For example:

<txp:adi_globals name="page" />

will return the current Page template name from $pretext.

adi_globals automatically searches through $prefs, $pretext, $thisarticle, $thispage, thissection, thisimage, $thiscomment, thiscategory, $thislink & $thisfile.

And, just for good measure, a TXP variable of the same name will be set as well.

If the global variable is not available then nothing will be output & no TXP variable will be set.

Attributes

name="var name"

- a TXP global variable to extract.

txpvar="boolean"

- duplicate the global variable as a TXP variable of the same name. Default = “1” (Yes).

quiet="boolean"

- don’t display variable value. Default = “0” (display variable value).

Sneaky peek …

If you’re curious what global variables are available, try:

<txp:adi_globals debug="1" />

This option is not available if PHP is disallowed in articles.

Additional information

Support and further information can be obtained from the Textpattern support forum. A copy of this help is also available online. More adi_plugins can be found here.

Version 0.3 - Download (Uncompressed) Support