diff --git a/main.cpp b/main.cpp index 1d64f92..520f6ac 100644 --- a/main.cpp +++ b/main.cpp @@ -1,6 +1,8 @@ #include "src/MicroCore.h" +#include "src/page.h" + #include "ext/crow/crow.h" #include "mstch/mstch.hpp" #include "ext/format.h" @@ -43,9 +45,11 @@ int main() { "Top block height : {:d}\n", height); - std::string view = xmreg::read("./templates/index.html"); + xmreg::page xmrblocks; - mstch::map context { + std::string view = xmrblocks.index(); + + mstch::map context { {"height", fmt::format("{:d}", height)}, {"blocks", mstch::array()} }; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 68f37db..4d576f3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,7 +12,7 @@ set(SOURCE_FILES MicroCore.cpp tools.cpp CmdLineOptions.cpp - tx_details.cpp) + tx_details.cpp page.cpp page.h) # make static library called libmyxrm # that we are going to link to diff --git a/src/page.cpp b/src/page.cpp new file mode 100644 index 0000000..56698ee --- /dev/null +++ b/src/page.cpp @@ -0,0 +1,5 @@ +// +// Created by mwo on 8/04/16. +// + +#include "page.h" diff --git a/src/page.h b/src/page.h new file mode 100644 index 0000000..86f6c29 --- /dev/null +++ b/src/page.h @@ -0,0 +1,43 @@ +// +// Created by mwo on 8/04/16. +// + +#ifndef CROWXMR_PAGE_H +#define CROWXMR_PAGE_H + + + +#include "../ext/minicsv.h" + +#include "monero_headers.h" +#include "tools.h" + + +#define TMPL_DIR "./templates" +#define TMPL_INDEX TMPL_DIR "/index.html" + +#define READ_TMPL(tmpl_path) xmreg::read(tmpl_path) + +namespace xmreg { + + + class page { + + public: + + string + index() + { + std::string view = READ_TMPL(TMPL_INDEX); + + return view; + } + + + private: + + }; +} + + +#endif //CROWXMR_PAGE_H