webserver templating seems to work fine
This commit is contained in:
parent
0ef3656bf6
commit
2252fe0142
2 changed files with 26 additions and 3 deletions
|
@ -29,6 +29,21 @@
|
|||
|
||||
#include "Page_root_HTML.h"
|
||||
|
||||
void WebPage_root(AsyncWebServerRequest *request) {
|
||||
request->send_P(200, "text/html", Page_root_HTML);
|
||||
// https://techtutorialsx.com/2018/07/23/esp32-arduino-http-server-template-processing-with-multiple-placeholders/
|
||||
String Proc_WebPage_root(const String& var) {
|
||||
Serial.println(":: [Webserver:Page:root:proc] start");
|
||||
Serial.print(":: [Webserver:Page:root:proc] var: ");
|
||||
Serial.println(var);
|
||||
|
||||
if(var == "LOL") {
|
||||
return String("omg das geht ja");
|
||||
} else if(var == "ROFL") {
|
||||
return String("rooooooofl geilooooomatic! omg %)");
|
||||
} else {
|
||||
return String();
|
||||
}
|
||||
}
|
||||
|
||||
void WebPage_root(AsyncWebServerRequest *request) {
|
||||
request->send_P(200, "text/html", Page_root_HTML, Proc_WebPage_root);
|
||||
}
|
||||
|
|
|
@ -29,5 +29,13 @@
|
|||
|
||||
|
||||
const char* Page_root_HTML PROGMEM = R"(
|
||||
<html><body><h1>CanGrow></h1></body></html>
|
||||
<html>
|
||||
<body>
|
||||
<h1>CanGrow</h1>
|
||||
Hi<br>
|
||||
%LOL%<br>
|
||||
%ROFL% <br>
|
||||
Bye<br>
|
||||
</body>
|
||||
</html>
|
||||
)";
|
||||
|
|
Loading…
Reference in a new issue