[PR #1769] [MERGED] Add user custom header/footer functions #1825

Closed
opened 2026-02-28 02:13:07 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/tzapu/WiFiManager/pull/1769
Author: @dmadison
Created: 10/23/2024
Status: Merged
Merged: 12/12/2024
Merged by: @tablatronix

Base: masterHead: header-footer


📝 Commits (9)

  • 6e6a8d9 Added setCustomTopBodyElement allowing to define custom HTML to be added at the top of the "" tag.
  • 5f02005 Change custom top body element to 'header'
  • 25fbfac Make custom header concat conditional
  • 40efe60 Create getHTTPEnd function
  • 82c074a Add custom body footer functionality
  • b253e11 Fix close tag on update page
  • 5d804f0 Add missing HTTP ends to exit and close
  • e2a287f Remove 'immediately' from header/footer desc
  • a03f4ee Merge branch 'master' into header-footer

📊 Changes

5 files changed (+60 additions, -15 deletions)

View changed files

📝 WiFiManager.cpp (+46 -10)
📝 WiFiManager.h (+11 -2)
📝 wm_strings_en.h (+1 -1)
📝 wm_strings_es.h (+1 -1)
📝 wm_strings_fr.h (+1 -1)

📄 Description

This PR adds user-facing functions for custom header and footer HTML at the top and bottom of the <body>:

Functions:

//add custom html at start of <body> for all pages
void setCustomBodyHeader(const char* html);

//add custom html at end of <body> for all pages
void setCustomBodyFooter(const char* html);

Demo:

wm.setCustomBodyHeader("<h1>THIS IS MY HEADER</h1>");
wm.setCustomBodyFooter("<h1>THIS IS MY FOOTER</h1>");

This also fixes two incidental bugs:

  • The <small> tag for the 'update' page was not closed (missing the slash)
  • The 'exit' and 'close' pages did not include the HTML end string ("</div></body></html>")

The header function was originally implemented by @ab-tools in #1695. This PR extends and supersedes #1695, which should be closed if this is merged.

header-footer-demo


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/tzapu/WiFiManager/pull/1769 **Author:** [@dmadison](https://github.com/dmadison) **Created:** 10/23/2024 **Status:** ✅ Merged **Merged:** 12/12/2024 **Merged by:** [@tablatronix](https://github.com/tablatronix) **Base:** `master` ← **Head:** `header-footer` --- ### 📝 Commits (9) - [`6e6a8d9`](https://github.com/tzapu/WiFiManager/commit/6e6a8d9b73128ab6a166abc26bd2edd04b51bdc5) Added setCustomTopBodyElement allowing to define custom HTML to be added at the top of the "<body>" tag. - [`5f02005`](https://github.com/tzapu/WiFiManager/commit/5f02005ca4b27a5bb3e6e7fba2d55b7d55b61850) Change custom top body element to 'header' - [`25fbfac`](https://github.com/tzapu/WiFiManager/commit/25fbfacd79119147027f31b78690272350465fd6) Make custom header concat conditional - [`40efe60`](https://github.com/tzapu/WiFiManager/commit/40efe60eda969077b9774affe0118d85120f7f7b) Create getHTTPEnd function - [`82c074a`](https://github.com/tzapu/WiFiManager/commit/82c074afdc785b297901792cbdf3b0f619f4b3a8) Add custom body footer functionality - [`b253e11`](https://github.com/tzapu/WiFiManager/commit/b253e11ed41e3f7a00fd7e398392836e54cba20e) Fix <small> close tag on update page - [`5d804f0`](https://github.com/tzapu/WiFiManager/commit/5d804f07fd71d2e00535d33daf97e94ae319b5cb) Add missing HTTP ends to exit and close - [`e2a287f`](https://github.com/tzapu/WiFiManager/commit/e2a287f57a07249ed39a005e30a21020394413a3) Remove 'immediately' from header/footer desc - [`a03f4ee`](https://github.com/tzapu/WiFiManager/commit/a03f4ee3e04c569b18d7fb2b8eccebb9ee19e2d6) Merge branch 'master' into header-footer ### 📊 Changes **5 files changed** (+60 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `WiFiManager.cpp` (+46 -10) 📝 `WiFiManager.h` (+11 -2) 📝 `wm_strings_en.h` (+1 -1) 📝 `wm_strings_es.h` (+1 -1) 📝 `wm_strings_fr.h` (+1 -1) </details> ### 📄 Description This PR adds user-facing functions for custom header and footer HTML at the top and bottom of the `<body>`: #### Functions: ```cpp //add custom html at start of <body> for all pages void setCustomBodyHeader(const char* html); //add custom html at end of <body> for all pages void setCustomBodyFooter(const char* html); ``` #### Demo: ```cpp wm.setCustomBodyHeader("<h1>THIS IS MY HEADER</h1>"); wm.setCustomBodyFooter("<h1>THIS IS MY FOOTER</h1>"); ``` This also fixes two incidental bugs: * The `<small>` tag for the 'update' page was not closed (missing the slash) * The 'exit' and 'close' pages did not include the HTML end string (`"</div></body></html>"`) The header function was originally implemented by @ab-tools in #1695. This PR extends and supersedes #1695, which should be closed if this is merged. ![header-footer-demo](https://github.com/user-attachments/assets/1f6ea25c-b2e5-421e-b707-529e9c56eeae) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 02:13:07 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#1825
No description provided.