Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-01-04 18:18:00

richtestani
Plugin Author
Registered: 2009-11-08
Posts: 128

Is there a PHP > Tag Reference?

I know there are PHP versions of each (or most) textpattern tags.
Is there any reference to these?

example: php version of variable tag

variable( array('name'='my_var', 'value'='my_val'));

Offline

#2 2010-01-04 18:45:24

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: Is there a PHP > Tag Reference?

All php functions inside TXP can be called as tags, though many wouldn’t make sense. taghandlers.php is where most of the functions intended for use by the tag template system are defined.

Offline

#3 2010-01-04 23:17:03

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Is there a PHP > Tag Reference?

richtestani wrote:

Is there any reference to these?

All core TXP tags are PHP functions (except comment form tags) and are exactly same as the TXP tag versions TXP’s tag parser just does simple transformation.

These:

<txp:example foo="bar" />
<txp:example />
<txp:example>thing</txp:example>

Become:

example(array('foo' => 'bar'))
example(array())
example(array(),thing)

Core tag functions reside in /textpattern/publish/taghandlers.php.

If the tag has no attributes, you put an empty array() inside of it as $atts parameter. If the function has attributes, then you place the attributes inside the array.

Second, and last, parameter is $thing, if the tag is a container. Thing is the contained statement.

All php functions inside TXP can be called as tags, though many wouldn’t make sense.

Only those that have right amount of attributes and expect that the first parameter is an array. That is if you don’t like notices, errors and fatal errors.

Offline

Board footer

Powered by FluxBB