-->
Page 1 of 2

easiest way to convert a website for ESP8266Webserver

PostPosted: Sun Sep 06, 2015 3:54 pm
by brutzler
Hi,
just trying to setup a little webserver with my ESP-12E.
I am editing a html-site with some css-functionality with notepad++.
Can anybody give me a hint, what would be the easiest way to convert it into "arduino-code"
I do not want to use a filesystem (e.g. SD-card or SPIFFS)
Looking at the examples, I found this way:

Here I have to add manually a "\" at the end of every line. :cry:
Code: Select all  snprintf ( temp, 400,
"<html>\
  <head>\
    <meta http-equiv='refresh' content='5'/>\
    <title>ESP8266 Demo</title>\
    <style>\
      body { background-color: #cccccc; font-family: Arial, Helvetica, Sans-Serif; Color: #000088; }\
.....
  server.send ( 200, "text/html", temp );

Does anybody know a more recent possibility?
thx in advance

Re: easiest way to convert a website for ESP8266Webserver

PostPosted: Sun Sep 06, 2015 4:37 pm
by martinayotte
Create a separate file to have your pages defines, using the R===== macro, a bit like the following :

Code: Select allconst char html_page1[] = R"=====(
<html><head></head><body background="/metalic.png">
<H1>Hello from MyAPServer !!!</H1>
<img src="/logo.png">
</body></html>)=====";


You can even add PROGMEM specifier if used with the proper functions, such as ESP8266WebServer::send_P()

Re: easiest way to convert a website for ESP8266Webserver

PostPosted: Sun Sep 06, 2015 5:24 pm
by brutzler
martinayotte wrote:using the R===== macro,

Never heard about that :o
Even google is not my friend in that case.... only found something about R-programming-language.
But your short example is getting compiled.

Now a few days in vacancy. After I will try it out

Re: easiest way to convert a website for ESP8266Webserver

PostPosted: Sun Sep 06, 2015 7:19 pm
by martinayotte
brutzler wrote:Never heard about that :o

I didn't knew that either until several ago when I saw some example on ESP forum ... :)