Two Anymod-Project-IDs on one Page

Can I call TWO AnyModProjectID’s on one page? In my case, I would even need to call 4 AnyModProjectID’s because 4 Domains run their own News-Blog-Sections, and the goal is to also display those four news sections on the Group-domain(page/project) :

my question in more detail: is entertaining a MOD containing Blog-like News-Content on AnyModProjectID= 86N4N3 .

My aim is to display that very same MOD on a different Domain called But that different domain has a different V2 Script , thus the AnyModProjectID differs = 87M4M7.

I stumbled upon the problem that the relevant MOD cannot be available on both AnyModProjectID’s at the same time. Is that true?

How may I call the same MOD if the AnyModProjectID on is different ?

I thought about an API Request, but I am not sure if this is possible in this scenario, also am I not sure if it is the best possible way to take. Is there an easier approach to solve my issue?

Also am I unaware of how to handle the json-data correctly, If my goal is to render the content on the page, having a different V2 Script AnyModProjectID.

Sorry to bother you with this edge case!

The core question is: I wonder how I may I reuse a MOD (best-way), if the Mod is inside one Project but it is supposed to also be available inside of a second Anymod-Project?

I hope the questioon is defined clearly enough to provide me with a helpful hint ; )

I am aware of cause, I may simply clone the MOD and tell the client to update the News Section twice: inside both Projects manually and separately. I would strongly prefer to find a way to reuse one MOD across more than one project.

The AnyModProjectID does not match with the MOD I aim to load. The Mod will not load on my second Project. Merely adding both Domainnames to the Project hosting the relevant MOD did not do the trick, of cause. Because the other domain is calling the V2 script with a different AnyModProjectID.

We don’t currently have an official way to use one mod across multiple projects in the way you’re describing. There would be a couple of workarounds:

  1. You could clone the mod into a new project, and whenever there is a content edit, use the merge feature to merge the content from one mod to another.

  2. You could access the “parent” mod’s data by API, and use that in your “child” mods. Then when you edit the “parent” mod’s content, it would automatically be used by the “child” mods. Here is the documentation on how to read a mod’s data:

Hopefully that helps!

Both solutions are interesting! The Idea to merge the mods is a nice workaround. I did not think of that. I just was not aware I may run a merge process all across different projects. Cool! So this would be a manual workaround I may use.

But I feel your second suggestion (to use the API to request) is more professional and might also be less work and more robust (once it is established ;). So I would like to give that solution a try. The problem here is that I have not yet worked with API and JSON Data much in the past. That leads me to a follow-up-question: If possible, could I ask you for a demo-Mod doing an API request on the below Mod-ID and also display the result in the browser:

The Part of the concept I am missing is how to transform the delivered json data in a way so that the Mod will render in the browser. You might be able to save me a lot of time by providing me with an example here. Perhaps. I will be greateful for any hint you may be able to provide to get me going .

What I would love the most is to create a Mod, only responsible for requesting that API Data (calling the URL ) as well as for the rendering of that json-content. Would that work? We would have a Mod requesting the JSON Data and also displaying its content . It would sort of be “A Mod inside of a Mod, via API”.

How may I display the relevant JSON Data once I have requested it?

I planned to work on this over the weekend :slight_smile:

Here’s an example of it at work:

My first impression is this Example Mod displays the API JSON content on the html page. Of cause, my goal is for the API-MOD content to render on the page. ( The aim is to display the content, not the data strings ). The result shall look just the same way as if the API-mod was called from within its own project. I will work more with your above example, and provide more feedback after I worked with it

I misunderstood the API! I thought it delivers everything! I expected it would also deliver the html,js, and css. But that is not the case. After I looked closer into the JSON-Data I realized only field-data is delivered. Okay, understood. So with this new understanding, I will have to work and think about how I may create the “child”-Mod inside of my ‘foreign anymod-V2-Project’ anew.
Will come back with more once I have done my homework :wink:

1 Like

I really need to find a solution for this. I am aware it might be an edge case. May I nevertheless as one follow up question?

The below mod is requiring DATA from an external MOD via API.

The data comming from the external mod has the exact same structure than the actual mod. Also the html and css and js of the current mod is exactly the same as inside the mod in the other project.
The data-field names are also exactly the same.

My goal is to use the external API data instead of the data comming from the data fields this mod originally uses.

I hope to overwrite the existing field-data with the external API-Data, alternatively I may only use the external-data right away (without overwriting).

My question is: How can I use the API Field-Data instead of the original field-data from this mod?

Please look at this fully pre-build Example-Mod inside a public project: It shows the API Data as well as the HTML structure that api-data needs to be applied to:

I am grateful for any hint you may provide ! ! ! I guess it should be easy, I just cannot wrap my head around how to apply the api-data

This is an issue I really need to adress. I created an entire Demo case and described my requirements. I depend on your reply to afterwards be able to decide how to proceed. I will be Greatful for any hint you might be able to provide!

Hi Stefan, you can inject the data from the API into the mod’s HTML using JavaScript. You could do this with regular JS, with jQuery, or with Vue or React. Here is a nice overview of adding data and manipulating the DOM with JS:

My issue at the moment is I dont know where to find the API-delivered data inside the DOM. Window.objects? But no worries. I will work my way into this. Or alternatively , I will use the workaround solution to merge the two versions manually each time after my client has changed the content. This definately is an edge case, anyway.

I think I should not use anything different than vue.js though. Because the Mod already uses vue.js -

As soon as I know how to grab those api-data-strings, I will find a way to manipulate the dom. Maybe you are right and I should rather use jquery to manipulate the dom, because I can handle jquery a bit better.

I will try to find the place where API delivered the data to in the browser .

I might also skip this and give up, and merge manually each time in the future.