Search
Other Articles Anywhere questions
Forum

Passing Parameters from loadmoduleid to custom module containing ArticlesAnywhere?

dee's Avatar dee
Dear Peter, I hope you are doing fine.

We are facing the following challenge, hopefully you (your extensions) can help us with:

On a quite complex website, the customer has many team members (each as an article with custom fields), which are automatically rendered via category blogs and custom layout overrides. Some of those team members though, need to be shown as well separately on other parts/pages of the website, with less/different custom fields rendered and/or different layouts.

Usually I would achieve this by using a custom module (for example with the ID 555), having code & styling inside of it, rendering this way a category with an example ID of 33, and only for the team members tagged "showextra", similar to this:
<div class="container-main">{articles category:id="33" tags="showextra"}
  <div class="container-image">[image-intro]</div>
  <div class="team_name">[team-name]</div>
  <div class="team_title">[team-title]</div>
  <div class="team_phone-extension">Tel. 089/ 55-[team-phone-extension]</div>
  <div class="team_mail">E-Mail: [team-mail]@domain.tld</div>
{/articles}</div>
...and then telling the customer to use just
{loadmoduleid 555}
...inside the article where he wants those team members tagged "showextra" to appear - so he does not have to mess around with the initial custom module html & layout.

This works quite well, but since there is an enormous amount of team members shown inside different articles, we would need to create for the customer many custom modules with separate category IDs inside. And here comes the big question:

Is there maybe a solution where the category ID could be set dynamically inside the loadmoduleid snippet (or maybe with the help of ModulesAnywhere), something like this:
{loadmoduleid 555,33}
...where the "33" after the comma is the category ID to load (the first parameter [param#1] or similar), changing the first line of the custom module to something like this:
<div class="container-main">{articles category:id=[param#1] tags="showextra"}

Or maybe you have even a better idea how to achieve this?
Peter van Westen's Avatar Peter van Westen ADMIN
You could use Snippets Pro instead of using modules.

Use the {snippet} tag and pass the info you want to it. Then in the Snippet, place the Articles Anywhere code.

See: docs4.regularlabs.com/snippets
docs4.regularlabs.com/snippets/going-fur...ing-dynamic-snippets
Please post a rating at the Joomla! Extensions Directory
dee's Avatar dee
Confidential information:
(hidden)
Peter van Westen's Avatar Peter van Westen ADMIN
Done 🙂
Please post a rating at the Joomla! Extensions Directory
dee's Avatar dee
Great, thanks! I can see the updated invoice, but cannot find a download link. Maybe a caching issue?
Peter van Westen's Avatar Peter van Westen ADMIN
Sorry about that, should be fixed now.
Please post a rating at the Joomla! Extensions Directory
dee's Avatar dee
Thank you! I could download Snippets Pro now.
Confidential information:
(hidden)
Peter van Westen's Avatar Peter van Westen ADMIN
Yes, sorry, there is too much coupling between the invoices and the subscription to be able to do what you asked.
I can refund your last Articles Anywhere payment, but I can't switch it over to a different extension. So you'll have to wait till you can purchase using your card.

I have set everything back to how it was.
Please post a rating at the Joomla! Extensions Directory
dee's Avatar dee
No all good, thanks. Let's keep it this way, I can work now - I am happy!
I guess updates won't work on snippets then?
Peter van Westen's Avatar Peter van Westen ADMIN
Correct, no updates or support until you have a valid subscription...
Please post a rating at the Joomla! Extensions Directory
dee's Avatar dee
Working great so far! Been windering though, if something like this is possible as well:
{articles id="%team-id%" tags="%tag%"}

so that one can decide if he wants to show a list of articles by ID or by tags, within the same snippet:
{snippet alias="team" team-id="150,130"}
or
{snippet alias="team" tag="showextra"}
Peter van Westen's Avatar Peter van Westen ADMIN
Yes, that is possible.
Please post a rating at the Joomla! Extensions Directory
dee's Avatar dee
hmmm... then there is something wrong with my setup?
cant get it to work as exmplained above...
it has got to be either "team-id" or "tag" in the snippet, do I need an if structure inside the articles anywhere code maybe?

the setup is as follows:
1. there is a category blog Menu Item X
2. having multiple articles assigned to the category
3. each article has custom fields (text area)
4. Article #1 has in its custom field {snippet alias="team" team-id="150,130"}
5. Article #2 has in its custom field {snippet alias="team" tag="showextra"}
6. visiting Menu Item X shows Article #1 and Article #2 underneath, but both snippets are not loading any conten!
7. if i remove inside the snippet ...{articles id="%team-id%" tags="%tag%"}... either id="%team-id%" or tags="%tag%", then one of the snippets inside the article works, that is showing data - so basicall the snippet with {articles id="%team-id%"} and the article with {snippet alias="team" team-id="150,130"} works (or vice versa - the snippet with {articles tags="%tag%"} and the article with {snippet alias="team" tag="showextra"} works), but if the snippet has {articles id="%team-id%" tags="%tag%"} none works...
Peter van Westen's Avatar Peter van Westen ADMIN
In the Snippet you have:
{articles id="%team-id%" tags="%tag%"}...
If you use:
{snippet alias="team" team-id="150,130"}
Then - assuming you have no defaults set in the Snippets variables - that will be translated to:
{articles id="150,130" tags=""}...
The empty tags="" is probably what is giving you unwanted results.
See: docs4.regularlabs.com/articlesanywhere/p...dvanced#empty-values

So you need to either set a default for the variables if nothing is given.
Or use if structures to output what you want depending on what data you pass it:
docs4.regularlabs.com/snippets/going-further/if-structures
Please post a rating at the Joomla! Extensions Directory
dee's Avatar dee
I assumed that if empty, it will not be taken into account. I added "*" into Default Value in the Snippet Variable and now it works! Thanks!
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription