MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

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

    Troubleshooting
    2
    6
    282
    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
      kasperb last edited by

      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 Reply Quote 0
      • S
        sdetweil @kasperb last edited by

        @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

        Create a working config
        How to add modules

        1 Reply Last reply Reply Quote 0
        • S
          sdetweil @kasperb last edited by sdetweil

          @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

          Create a working config
          How to add modules

          K 1 Reply Last reply Reply Quote 0
          • K
            kasperb @sdetweil last edited by

            @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 Reply Quote 0
            • S
              sdetweil @kasperb last edited by sdetweil

              @kasperb node_helper.js

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

              and
              MMM-HTMLSnippet.js

              wrapper.src = '/MMM-HTMLSnippet'
              

              Sam

              Create a working config
              How to add modules

              K 1 Reply Last reply Reply Quote 0
              • K
                kasperb @sdetweil last edited by

                @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
                • First post
                  Last post
                Enjoying MagicMirror? Please consider a donation!
                MagicMirror created by Michael Teeuw.
                Forum managed by Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
                This forum is using NodeBB as its core | Contributors
                Contact | Privacy Policy