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

static text to MM2

Scheduled Pinned Locked Moved Solved Troubleshooting
5 Posts 2 Posters 1.6k 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
    killing joke
    last edited by killing joke Jul 2, 2018, 8:23 PM Jul 2, 2018, 5:05 PM

    Hey @ all,

    I´m a freshy at raspberrypi and I copied the “helloworld”-module to create a static-text-module with a name “MMM-static-text” just to avoid any problems in future if someone changes the “helloworld” for any reasons.
    I changed the names of the folder, files and within the file to “MMM-static-text”
    MMM-static-text.js:

    /* global Module */
    
    /* Magic Mirror
     * Module: MMM-static-text
     *
     * By Michael Teeuw http://michaelteeuw.nl
     * MIT Licensed.
     */
    
    Module.register("MMM-static-text",{
    
    	// Default module config.
    	config: {
    		text: "Wetterinformationen"
    	}
    });
    

    config.js:

    {	module: "MMM-static-text",
    			position: "top_right",
    			config:{
    				text: "Wetterinformationen"
    			}
    		},
    

    Unfortunatelly it doesn´t show “Wetterinformation”. Instead it shows “MMM-static-text” and below “module_4_MMM-static-text”. If I use the helloworld-module it is the same.
    What is wrong with my module?
    Thanks for any help.
    Best Regards
    Daniel

    1 Reply Last reply Reply Quote 0
    • Y Offline
      yawns Moderator
      last edited by Jul 2, 2018, 10:03 PM

      Did you change all files in modules/default? Or did you create a folder MM-static-text in modules ?

      K 1 Reply Last reply Jul 3, 2018, 8:06 AM Reply Quote 0
      • K Offline
        killing joke @yawns
        last edited by killing joke Jul 3, 2018, 8:08 AM Jul 3, 2018, 8:06 AM

        Hi @yawns

        I copied the complete helloworld-folder from modules/default to modules and renamed it to MMM-static-text.
        I renamed all files as well.
        This is the outcome…
        0_1530605311658_Forum.png

        1 Reply Last reply Reply Quote 0
        • Y Offline
          yawns Moderator
          last edited by Jul 3, 2018, 9:38 AM

          Ah, I see. The module is missing the code to actually display/do something, either directly or via template system.

          /* global Module */
          
          /* Magic Mirror
           * Module: MMM-static-text
           *
           * By Michael Teeuw http://michaelteeuw.nl
           * MIT Licensed.
           */
          
          Module.register("MMM-static-text",{
          
          	// Default module config.
          	defaults: {
          		text: "Wetterinformationen!"
          	},
          
          	// Override dom generator.
          	getDom: function() {
          		var wrapper = document.createElement("div");
          		wrapper.innerHTML = this.config.text;
          		return wrapper;
          	}
          });
          
          K 1 Reply Last reply Jul 3, 2018, 11:22 AM Reply Quote 0
          • K Offline
            killing joke @yawns
            last edited by Jul 3, 2018, 11:22 AM

            Hi @yawns ,

            thanks a lot. This works fine after I copied your code into my file.
            Just typing the rest of the missing code does´nt worked. I had to copy the code.
            I assume a missing ; or ,.
            Anyway I fixed with your help.
            Thanks a lot!

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            1 / 1
            • First post
              1/5
              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