X-Git-Url: https://harishankar.org/repos/?p=biaweb2.git;a=blobdiff_plain;f=biawebnavigationbit.hpp;h=08a2cc505f65ae4ef886b117925611b6007350fc;hp=6be5b40cef93b9bd53a909631324ff0cb21ae3be;hb=eda0b06c5328e232e12e0535528a528493caa90a;hpb=44d5fb1ff24147859c5f198dd47f6956ec5fea51 diff --git a/biawebnavigationbit.hpp b/biawebnavigationbit.hpp index 6be5b40..08a2cc5 100644 --- a/biawebnavigationbit.hpp +++ b/biawebnavigationbit.hpp @@ -6,6 +6,7 @@ #include #include "biawebutil.hpp" #include "biawebsidebar.hpp" +#include "biawebtemplate.hpp" namespace biaweb { // class to represent a navigation bit like this in html @@ -21,20 +22,17 @@ namespace biaweb { } // render using the given template directory - std::string to_html (std::string templatedir) ; + std::string to_html (Template *t) ; }; // render using the given template - std::string NavigationBit::to_html (std::string templatedir) { - std::ifstream templ (templatedir + "/navigationbit.tpl.html"); - std::string templ_str ((std::istreambuf_iterator (templ)), - (std::istreambuf_iterator ())); - + std::string NavigationBit::to_html (Template *t) { + std::string templ_str = t->get_navigationbit_tpl (); std::string output_html = ""; std::string items_str = ""; for (GenericLinkItem item : this->items) - items_str += item.to_html (templatedir); + items_str += item.to_html (t); if (this->items.size () > 0) output_html = fmt::format (templ_str, fmt::arg ("items", items_str));