khoih-prog / ESP_WiFiManager_Lite

Light-Weight MultiWiFi/Credentials Manager for ESP32 (including ESP32-S2 and ESP32-C3) and ESP8266 boards boards. Powerful-yet-simple-to-use feature to enable adding dynamic custom parameters. paragraph=Library to configure MultiWiFi/Credentials at runtime for ESP32/ESP8266 boards. You can also specify DHCP HostName, static AP and STA IP. Use much less memory compared to full-fledge WiFiManager. Config Portal will be auto-adjusted to match the number of dynamic custom parameters. Optional default Credentials to be autoloaded into Config Portal to use or change instead of manually input. Credentials are saved in LittleFS, SPIFFS or EEPROM. New powerful-yet-simple-to-use feature to enable adding dynamic custom parameters from sketch and input using the same Config Portal. Double or MultiDetectDetector as well as Virtual Switches feature permits entering Config Portal as requested.
MIT License
49 stars 15 forks source link

Overriding the HTML #1

Closed MythicalForce closed 3 years ago

MythicalForce commented 3 years ago

Is your feature request related to a problem? Please describe.

Well the problem im having is that i want to customize the HTML page without doing it in the lib header file itself. I noticed that there is ESP_WiFiManager->setCustomsHeadElement(); and i could add my HTML there but the problem is that then it would display my HTML along with defaults in the lib header file:

and so on! the only thing i can set that overrides is the "style" ESP_WiFiManager->setCustomsStyle(NewCustomsStyle);

it is super cute that you added // DO NOT CHANGE THIS STRING EVER!!!! i saw this and laughed and started right away editing it to customize the webpage to my liking 👍

Describe the solution you'd like

An easy way to override the current HTML set inside the lib header file!

Describe alternatives you've considered

NONE

Additional context

NONE

khoih-prog commented 3 years ago

Thanks for your interest in the library which provides simple and general-purpose features

If you'd like to modify and add custom's HTML, I guess and expect you have good programming knowledge to know how to do it yourself.

Just add some #ifdef to permit you to override the library's HTML and use whatever way you'd like. The code is public anyway.

You can easily do whatever you'd like to meet your use-case's requirements.

I prefer to keep the library simple and won't spend time on this rare case.

I'm closing the request now.

MythicalForce commented 3 years ago

Just add some #ifdef to permit you to override the library's HTML and use whatever way you'd like.

does not work! i added #if USING_CUSTOMS_HEAD_ELEMENT but not working... it still shows the default HTML in the lib along side mine..

khoih-prog commented 3 years ago

You didn't use it correctly. Please read the code to understand what has been written, what you need to do, then use your imagination

For example

#ifndef USING_DEFAULT_CUSTOMS_HTML    
  #define USING_DEFAULT_CUSTOMS_HTML     true  
#endif

#if USING_DEFAULT_CUSTOMS_HTML

  const char ESP_WM_LITE_HTML_HEAD_START[] = "<!DOCTYPE html><html><head><title>ESP_WM_LITE</title>";

...

#else

// These are your customs HTLMs
const char ESP_WM_LITE_HTML_HEAD_START[] = "<!DOCTYPE html><html><head><title>NEW_TITLE</title>";

...

#endif

In your sketch

#define USING_DEFAULT_CUSTOMS_HTML    false

You can also use extern instead of const char ESP_WM_LITE_HTML_HEAD_START[], then declare in your sketch

const char ESP_WM_LITE_HTML_HEAD_START[] = "????";

Sorry I don't like to waste my time here. You have to research and do it yourself.

MythicalForce commented 3 years ago

that still would be a problem if you then make changes / new release and i update the lib on my end it would go back to using the HTML in the lib....