• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Running the same module twice with different URL, but same content is being displayed (MMM-HTMLSnippet)

Scheduled Pinned Locked Moved Troubleshooting
6 Posts 2 Posters 817 Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    kasperb
    last edited by Sep 14, 2020, 9:21 PM

    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,
          },
      },```
    S 2 Replies Last reply Sep 14, 2020, 9:36 PM Reply Quote 0
    • S Offline
      sdetweil @kasperb
      last edited by Sep 14, 2020, 9:36 PM

      @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…

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @kasperb
        last edited by sdetweil Sep 14, 2020, 11:25 PM Sep 14, 2020, 11:23 PM

        @kasperb you could hack one module to get what I want.

        edit the second one, where u changed the name. change the

        /MMM-HTMLSnippet
        

        to

        /MMM-HTMLSnippet2
        

        in both .js files

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        K 1 Reply Last reply Sep 15, 2020, 1:22 PM Reply Quote 0
        • K Offline
          kasperb @sdetweil
          last edited by Sep 15, 2020, 1:22 PM

          @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.

          S 1 Reply Last reply Sep 15, 2020, 1:27 PM Reply Quote 0
          • S Offline
            sdetweil @kasperb
            last edited by sdetweil Sep 15, 2020, 1:34 PM Sep 15, 2020, 1:27 PM

            @kasperb node_helper.js

            this.expressApp.get("/MMM-HTMLSnippet", (req, res) => {
            

            and
            MMM-HTMLSnippet.js

            wrapper.src = '/MMM-HTMLSnippet'
            

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            K 1 Reply Last reply Sep 15, 2020, 1:34 PM Reply Quote 0
            • K Offline
              kasperb @sdetweil
              last edited by Sep 15, 2020, 1:34 PM

              @sdetweil You’re right; I missed that one.

              Thank you - that did the trick and both versions of the module now work as expected.

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              1 / 1
              • First post
                1/6
                Last post
              Enjoying MagicMirror? Please consider a donation!
              MagicMirror created by Michael Teeuw.
              Forum managed by Sam, technical setup by Karsten.
              This forum is using NodeBB as its core | Contributors
              Contact | Privacy Policy