Search
Other Articles Field questions
Forum

Is it possible to use the articleslinked field as dynamic content in Yootheme?

Rikard Jespersen's Avatar Rikard Jespersen
Hi
I'm not sure if this is a question for the YooTheme team, or Regular labs, but I'll just state my question and if this is the wrong forum, I'll take my question to the YooTheme forum instead.

I'm using articles field in Joomla 4 to connect Parent articles to child articles.

Like this:

Tulips (parent)
-Green (child)
-Blue (child)
-Red (child)

My tulip page has the red, blue and green pages assigned as children through a custom article field. All the other articles have the custom field "Articles linked" set to show. It has the id 61, and I can set {field 61} in the body which works perfectly in the front end, I get my backlink with the name set in my custom fields.

I am using YooTheme builder for a lot of my pages, and I have templates made for most of my them, including the Tulips. On my Tulip main page (parent) I can show all my sub pages (children) dynamic content in YooTheme Builder. But I can't get the link from the children back to the parent to work. When I set the articlesrelated as dynamic content link, I get the URL "1", instead of a link to the actual article.

If this is not possible at the moment, I'm thinging that I might be able to use ReReplacer to replace something like "MY_CUSTOMFIELD_61" with {field 61}, but I don't know if that is even possible? I've done something similar with language contants in YooTheme, but I'm quessing it is something completely different to replace something like this, that once replaced must be rendered.

Thank you for your time,
Peter van Westen's Avatar Peter van Westen ADMIN
The Articles Linked field itself just has a 1/0 value (yes / no).
You will need to pass it through the field layout to get the full output.

I am not sure what you are trying to do with the linking inside the YooTheme builder itself.
Please post a rating at the Joomla! Extensions Directory
Rikard Jespersen's Avatar Rikard Jespersen
Hi Peter
I am trying to add the link to the parent article as a button in the Yootheme builder. And I want to add it to the category template, that way editors won't need to add it to specific articles themselves, it will always be present if the article has a parent article.

Best regards
Peter van Westen's Avatar Peter van Westen ADMIN
So I guess you would need to use a custom layout for that field. As the field itself does not contain the URL to the articles.
Please post a rating at the Joomla! Extensions Directory
Rikard Jespersen's Avatar Rikard Jespersen
That is indeed the case if the field doesn't contain more than 1 or 0. But how about my second approach. Using ReReplacer? Since I know that the field I want to render have the ID 61 I could hard code {field 61} in the builder. But Yootheme builder won't parse it.

You helped me with language contants earlier, so I've setup a set of rules that will parse those for me, but this is different i reckon. So I don't know if it is even possible.
Peter van Westen's Avatar Peter van Westen ADMIN
Probably the {field} tag won't get handled either, as it is a content plugin.
I recommend you try Articles Anywhere instead:
{article}[my-linked-field-name]{/article}
Please post a rating at the Joomla! Extensions Directory
Rikard Jespersen's Avatar Rikard Jespersen
Thank you, that works like a charm!

A follow up question, is it possible to add language contants to the custom HTML of the custom field? I would like to add the title of the custom fieled to the generated link, or add a cutom language constant.

Right now I have this as my layout custom HTML:
<a class="uk-width-1-1 uk-button uk-button-primary" href="[url]">Parent page: [title]</a>
I would like to have "parent page:" localised, using my language contants, but "MY_LANGUAGE_CONSTANT" is not fetched, instead it is rendered exactly as written. I had a look here docs4.regularlabs.com/articlesfield/the-basics/layout for usable data tags but I couldn't find what I was looking for.

Best regards,
Peter van Westen's Avatar Peter van Westen ADMIN
No, you can't place php code in the Custom HTML field.

But you can look into making a full layout override for the field, and select that in the settings.
Please post a rating at the Joomla! Extensions Directory
Rikard Jespersen's Avatar Rikard Jespersen
Thank you Peter, that's easy enough, I'll do that.
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription