3 * html.c: HTML header/footer templating for web interface.
4 * copyright (c) 2006 Ben Stewart.
5 * copyright (c) 2010 Malte S. Stretz.
7 * You may use, modify and redistribute this file under the terms of the
8 * GNU General Public License version 2. (see COPYING.GPL)
11 #include "config.h" /* for PACKAGE_STRING */
14 #include "http.h" /* for base_url */
16 void html_open(struct str
*buf
, const char *title
, const char *interface
,
17 void (*header_callback
)(struct str
*buf
))
23 str_appendf(buf
, "<title>%s (darkstat3 : %s)</title>\n"
24 "<meta name=\"generator\" content=\"%s\" />\n", title
, interface
,
26 str_append(buf
, "<meta name=\"robots\" content=\"noindex, noarchive\" />\n");
27 str_appendf(buf
, "<link rel=\"stylesheet\" href=\"%s%s\" type=\"text/css\"/>\n",
28 base_url
, "style.css");
29 if (header_callback
!= NULL
)
32 str_append(buf
, "</head>\n"
34 "<div class=\"menu\">\n"
35 "<ul class=\"menu\">\n");
36 str_appendf(buf
, "<li class=\"label\">%s</li>\n"
37 "<li><a href=\"%s\">graphs</a></li>\n"
38 "<li><a href=\"%shosts/\">hosts</a></li>\n"
39 "<li><a href=\"http://dmr.ath.cx/net/darkstat/\">homepage</a></li>\n",
40 PACKAGE_STRING
, base_url
, base_url
);
41 str_append(buf
, "</ul>\n"
43 "<div class=\"content\">\n");
44 str_appendf(buf
, "<h2 class=\"pageheader\">%s</h2>\n", title
);
47 void html_close(struct str
*buf
)
57 /* vim:set ts=4 sw=4 tw=78 expandtab: */