Articles Field

Count number of article field values per article

3 months 3 weeks ago #89741

Octav A's Avatar Octav A

Hello,
Please help how to display count of Articles linked per per article?
Thanks

3 months 3 weeks ago #89742

Peter van Westen's Avatar Peter van Westen Admin

You would have to do this with a custom layout, which you can create and then select in the Options tab of the custom field.
Then you can do a count on the fields rawvalue (array of article ids).

3 months 3 weeks ago #89743

Octav A's Avatar Octav A

😁 I figured out that this is the solution but hoped that some magic may be as it is in other cases with your fields and articles. Thanks

3 months 3 weeks ago #89750

Octav A's Avatar Octav A

Actually there is some magic. For anyone who may need this. - the simplest solution was to display the count not by custom field but like this:

{articles id="this:custom_field" limit="1"}[total_no_limit]{/articles}
Which gives me the output i need.
However i dont know about performance. Would it be faster loading to use a custom_field override for counting linked articles?

3 months 3 weeks ago #89753

Peter van Westen's Avatar Peter van Westen Admin

Yep, you can do this with Articles Anywhere 🙂

Loading via direct php will probably be marginally faster, as then you only do what is absolutely necessary.
Using a plugin tag requires Joomla to pass the content to the plugin, the plugin to search for it and replace it, etc.

But unless you have some loop causing this tag to be placed many many times on one page, the effect will be negligible.
Especially with caching in play.

3 months 3 weeks ago #89761

Octav A's Avatar Octav A

Got it, thanks!