Search
Other Articles Anywhere questions
Forum

Use custom field value as article id

Thomas Venugopal's Avatar Thomas Venugopal
Hello, when I‘m trying to use this
{article id="[custom-field output="value"]"}[text]{/article}

I get nothing. Is this supposed to be that way, am I missing something or am I doing it wrong?
Thomas Venugopal's Avatar Thomas Venugopal
I don't get it, sorry.

I have a first article with a custom field (let's say c-hl). In this field is a value of a second article id (let's say 1012).

I want to pull the text of the second article into the first article by using the value of the custom field "headline" of the first article.

So in the first article in a static way I would write:

{article id="1012"}[text]{/article}

But I don't want to enter the article id manually. Instead I want to pull that id from the current articles custom field calles "c-hl".

When I try different variations the page just breaks or doesn't load at all. This {articles c-hl="this:id"}[text]{/articles} doesn't do anything. Could clarify how to get the value of the custom field of the current article into the filter as described above?

What does that sentence mean?
Any data from the current article that contains the Plugin Tag or is being currently displayed
Peter van Westen's Avatar Peter van Westen ADMIN
Try:
{articles id="this:c-hl"}
Please post a rating at the Joomla! Extensions Directory
Thomas Venugopal's Avatar Thomas Venugopal
No output with this:

{article id="this: c-hl"}{/article}

or this

{articles id="this: c-hl"}{/articles}
Peter van Westen's Avatar Peter van Westen ADMIN
Remove the space after the ':'.
Please post a rating at the Joomla! Extensions Directory
Thomas Venugopal's Avatar Thomas Venugopal
Great, Works, Thanks.
Thomas Venugopal's Avatar Thomas Venugopal
Question: Why does it only work with the articles tag but not with article tag? Are there performance differences between these two tags?
Thomas Venugopal's Avatar Thomas Venugopal
And I noticed another thing.

{articles id="this:c-ba"}{if badge}[badge]{else}<img src="/default-badge.png" class="uk-width-small"/>{/if}{/articles}

When the custom field badge is empty I don't get the fallback image, it just shows nothing.
Peter van Westen's Avatar Peter van Westen ADMIN
It should work with:
{article id="this:c-ba"}

To check for a value, try:
{if badge:value}

Please read the documentation (all of it)... as 90% of your questions are all answered in the documentation.
Please post a rating at the Joomla! Extensions Directory
Thomas Venugopal's Avatar Thomas Venugopal
Do you really think that I come up with this without reading the docs? 😁 I read it for hours exploring a new syntax you created and changed for Joomla 4 again. And after reading, you have to do it and understand it. That's a lot of time. As a customer you have to learn a whole new syntax to use your product, that's the reason why we bought a full bundle license to get support if we have questions.

I really only ask a question when I don't understand something or couldn't find an article where I could imagine that it fits my needs. I really appreciate your answers, and often the link to the right doc helps. Additionally, sometimes we encounter bugs and until we get an answer it's not clear if we should invest time in something if it's not clear if it's a bug and or a mistake on our side. That's the reason why I ask in this case.

In this case, I tried everything you provided, but it does not work for me. For example, it's not clear why the tag does work with the multiple article field but not with the single article field, as mentioned above. And the question regarding performance is unanswered, too.

Anyway, I tried this:

{articles id="this:c-ba"}{if badge:value}[badge]{else}<img src="/badge.png" />{/if}{/articles}

But it returns no fallback, when the custom field c-ba is empty. When a valid value is available, it works. So basically only the fallback doesn't work.
Peter van Westen's Avatar Peter van Westen ADMIN
This is working fine on my setups:
{article id="this:some-custom-field"}...{/article}

This is also working fine:
{if some-custom-field}[some-custom-field]{else}Fallback{/if}

However, if you have a default value set on that custom field, then it won't be seen as empty. It will use that value.

What type of field is it? A standard text field?
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription