Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2013-08-21 20:31:18

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: count number of article images

Gocom wrote:

I would discourage calling tag functions directly. Its way more likely that the function will be gone, than the parser or the syntax changes. As long as PHP doesn’t reserve parser as function or keyword.

Thanks, reverted the code to parse (but AFAIK, name="article_image" is undocumented)

The only documented way of accessing the tags is by template strings, or querying the registry.

Querying global variables (or the registry?) is much faster than calling the parser, I hope future versions will still allow it.

"id IN ('".implode("','", $ids)."')");

I have shamelessly borrowed it from some txp function. :)

Offline

#14 2016-06-16 17:53:45

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: count number of article images

I didn’t think to search for this thread the other day when I was trying to figure this out. But I did come up with a method using adi_calc.

        <txp:variable name="images-count" value="0" />
        <txp:images form="images-count" break="" />

and for the images-count miscellaneous form:

        <txp:adi_calc name="images-count" add="1" />

Offline

Board footer

Powered by FluxBB