Read the statement by Michael Teeuw here.
MMM-Remote-Control # More files *.html (pages)
-
@Ciastuus said in MMM-Remote-Control # More files *.html (pages):
wrapper.innerHTML = "http://" + this.addresses[0] + ":8080/index.html"; wrapper.innerHTML = "http://" + this.addresses[0] + ":8080/lustro.html"; wrapper.innerHTML = "http://" + this.addresses[0] + ":8080/narzedzia.html";
1st… the html is not processed until you return the whole html block to mm…
return wrapper;
second, you set innerHtml
wrapper.innerHTML = "http://" + this.addresses[0] + ":8080/index.html";
then overwrote it
wrapper.innerHTML = "http://" + this.addresses[0] + ":8080/lustro.html";
then overwrote it.
wrapper.innerHTML = "http://" + this.addresses[0] + ":8080/narzedzia.html";
and then returned the html content
return wrapper;
only the last
wrapper.innerHTML =
should work
-
So … After each wrapper.innerHTML I have to add
return wrapper;
e.g:
wrapper.innerHTML = "http://" + this.addresses[0] + ":8080/index.html"; return wrapper; wrapper.innerHTML = "http://" + this.addresses[0] + ":8080/lustro.html"; return wrapper; wrapper.innerHTML = "http://" + this.addresses[0] + ":8080/narzedzia.html";
Is that way?
wrapper.innerHTML = "http://" + this.addresses[0] + ":8080/index.html"; wrapper.innerHTML = "http://" + this.addresses[0] + ":8080/lustro.html"; wrapper.innerHTML = "http://" + this.addresses[0] + ":8080/narzedzia.html"; return wrapper;
-
no… you can only have ONE innerHtml per return…
last one u did wins…
if u need more info in the html, you will need to add multiple elements with the additional html…
if u did this manually, created a page to display ALL the html, what would it look like?
what you do in MagicMirror is exactly the same -
Can you explain it to me with any example? I don’t understand JavaScript very well … Maybe you can give discord on priv?
-
@Ciastuus many html elements (p, div, span, … ) have an innerHtml attribute that will wrap text or raw html.
a web page is made up of hundreds of html elements…
the MagicMirror model is a single web page… and each module contributes a little bit of that content.
the getDom() routine is MagicMirrors request to the module to supply the html for ITS content. (paragraph, table, … whatever)…
BUT, until the getDom() routine returns, the stuff built is just in the modules memory space.
the content provided to MagicMirror is then inserted into the dom in the appropriate location based on the ‘position’ you provided in config.js.
the content can be built lots of different ways…
hard coded html text (just like a html file)
some hard coded and some built by building the little dom tree for the modules content
or all apis…none of this is MagicMirror specific, as it uses the documented Document Object Model (dom) apis defined my the w3c standards.
your module’s content starts with a
< div> innerHtml is here < /div>
and then u set its div.innerHtml, or call div.appendChild(anotherElement)