Sure, nobody has ever done that accidently and ended up in a world of hurt. You should take every opportunity in your code to prevent nasty surprises. Following best practices helps and also shows that you have some idea of what you're doing.
I thank ya’ll for gettin so prompting into my problem,…and its secondary element that I hardly understood anything…
Dear Deva_Rishi
That is how it’s done ! keep in mind if you are sending html these sort of things should be a part of your code
Code: [Select]
const char
*pageheader = “”,
*htmlhead = “Your Title<meta http-equiv=“Content-Type” content=“text/html;charset=utf-8” />”,
*bodystyle = “<body style=“color: wheat; background-color: teal; font-size: 12pt; font-family: sans-serif;”>”,
*htmlclose = “”;
and make sure that you close any tag that you open.
I just tried this code of yours,nevertheless didnt understand what its about…
It didnt work tho…
heres how I used it
No big surprise here, i’ve made the same mistake once as well.
what you need to do is send all the code in one go.First collect it all in a String.
String s;
s+=pageheader;
s+=htmlhead;
s+=bodystyle;
s+= "" // your part of the page, header, links, forms, paragraphs & other info
s+=htmlclose;
and then send it.server.send(200, "text/html", s);
within this bit you can define colors, textfonts etc. *bodystyle = "<body style=\"color: wheat; background-color: teal; font-size: 12pt; font-family: sans-serif;\">",hope you figure this out.
Arduino: 1.8.8 (Windows Store 1.8.19.0) (Windows 10), Board: "NodeMCU 0.9 (ESP-12 Module), 80 MHz, Flash, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"
C:\Users\MEHARR\Desktop\tetee\tetee.ino: In lambda function:
tetee:40:36: error: 's' is not captured
server.send(1000, "text/html", s);
^
Multiple libraries were found for "ESP8266WebServer.h"
Used: C:\Users\MEHARR\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.4.2\libraries\ESP8266WebServer
Not used: C:\Users\MEHARR\Documents\Arduino\libraries\ESPWebServer-master
exit status 1
's' is not captured
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Thanks Deva rishi
…you’ve gone through my code wholly…damn thanks for that
now since i m a moron, i still cant understand a few things
I assume in your *pageheader you are tryna put some http link i.e. www.w3.org, so that it would be accessible on the web page…But I dont get any link to follow on the web page…
I actually was tryna send related syntax so that I would get to collect data from client…as the syntax of form has a number " 's in between,so complier confuses 'em with termination of command…I dont even know under what heading should i search it on google…
i hope You got me right with being disappointed…Thanks man for being there
sabishaw:
I assume in your *pageheader you are tryna put some http link i.e. www.w3.org, so that it would be accessible on the web page....But I dont get any link to follow on the web page......
To it is not a link to a webpage it is a definition of what the webpage complies with. the guys at w3.org decide the html rules.
the '"' is similar to '\r' & '\n' and since html uses the " a lot you'll use '"' a lot, which doesn't improve readability..