Read the statement by Michael Teeuw here.
static text to MM2
-
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 -
Did you change all files in
modules/default? Or did you create a folderMM-static-textinmodules? -
Hi @yawns
I copied the complete
helloworld-folder frommodules/defaulttomodulesand renamed it toMMM-static-text.
I renamed all files as well.
This is the outcome…

-
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; } }); -
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!
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