Read the statement by Michael Teeuw here.
Running the same module twice with different URL, but same content is being displayed (MMM-HTMLSnippet)
-
Hi all,
I’m running two instances of MMM-HTMLSnippet on my mirror with the objective of showing two different twitter feeds (CNN & Axios). I’ve copied the initial module in the modules folder, renamed it to ‘MMM-HTMLSnippet2’ and changed the *.js file to ‘MMM-HTMLSnippet2.js’. I’ve also updated the first line in *.js file to MMM-HTMLSnippet2. Finally, I’ve updated my config as outlined below.
However, both modules are showing the CNN twitter feed on my mirror.
What did I miss?!
Thanks!
{ module: "MMM-HTMLSnippet", position: "bottom_right", config: { html:`<a class="twitter-timeline" data-height="500" data-dnt="true" href="https://twitter.com/cnnbrk?ref_src=twsrc%5Etfw">Tweets by cnnbrk</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>`, //insert your script or html codes here. width: "400px", height: "500px", backgroundColor: "#FFF", updateInterval: 3600000, }, }, { module: "MMM-HTMLSnippet2", position: "bottom_left", config: { html:`<a class="twitter-timeline" data-height="500" data-dnt="true" href="https://twitter.com/axios?ref_src=twsrc%5Etfw">Tweets by axios</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>`, //insert your script or html codes here. width: "400px", height: "500px", backgroundColor: "#FFF", updateInterval: 3600000, }, },``` -
@kasperb sadly the module is not designed to be used in multiples
the problem is the url to get the html (which isn’t needed anyhow)
the node helper sets up a ‘server’ to return the html,. and the web side calls to get it
‘/MMM-HTMLSnippet’but MM cannot have two servers with the same name, so first one wins…
if you turn the two entries around, the resutls will be from the top one…
-
@kasperb you could hack one module to get what I want.
edit the second one, where u changed the name. change the
/MMM-HTMLSnippetto
/MMM-HTMLSnippet2in both .js files
-
@sdetweil Thanks for your response. When you say both *.js files, which ones exactly do you mean? There is only one *.js file in the folder with ‘MMM-HTMLSnippet’ in it.
-
@kasperb node_helper.js
this.expressApp.get("/MMM-HTMLSnippet", (req, res) => {and
MMM-HTMLSnippet.jswrapper.src = '/MMM-HTMLSnippet' -
@sdetweil You’re right; I missed that one.
Thank you - that did the trick and both versions of the module now work as expected.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login