ceegeye's xhtml class interface

 html class interface In general to make an HTML page first construct the page:-

CGI cgi;
xhtml p(cgi);

close the http header by calling the pagebegin function:-

p.pagebegin("The Title of the page");

or

p.pagebegin("Title", "", "mycss.css", "Expires: Thu, 01 Dec 2009 16:00:00 EST");

or

p.pagebegin( );

open the body tag of the page:-

p.body( ); //or p.body("id_attribute_name", "", "pageload( )");

now call various functions of the webpage class to create forms tables links etc. see below for further details Most of the functions have default arguments so they do not need to be supplied. Check the header <ceegeye/xhtml.h> or the function interfaces below for the default arguments to each function.

xhtml interface:

construction/destruction
example of use:

using namespace ceegeye;
CGI cgi;
xhtml p(cgi);
p.pagebegin("My Page");
p.body();
p.p();
p << " Number 123 + 300 = " << 123 + 300 // is the same as:
std::cout << " Number 123 + 300 = " << 123 + 300;
p.pend();

incapsulate the http headers needed for CGI This function must be called before any other to ensure the http headers are closed correctly.

void pagebegin(const string& title = "untitled page",
const string& headtag = "",
const string& cssfile = "",
const string& httpheaders = "",
const string& contenttype = "text/xhtml");

visible part of page.

void body(const string& id = "", 
const string& Class = "",
const string& onload = "");

Encapsulate html form tags.

void form(const string& id = "",
const string& action = "",
const string& onsubmit = "",
/* "multipart/form-data" */
const string& encoding = "application/x-www-form-urlencoded",
const string& method = "post");
void formend( );

void inputsubmit(const string& name,
const string& value,
const string& onclick = "",
const string& Class = "",
const string& tooltip = "") const;

void inputbutton(const string& name,
const string& value,
const string& onclick = ""
const string& Class = "") const;

void inputfile(const string& name,
const string& filename,
const string& size = "",
const string& onclick = "",
const string& Class = "") const;

void inputhidden(const string& name,
const string& value) const;

void inputradio(const string& name,
const string& value,
bool checked = false,
const string& onclick = "",
const string& Class = "") const;

void inputtext(const string& name,
const string& value,
const string& Class = "",
const string& size = "",
const string& maxlen = "",
const string& onblur = "",
const string& onchange = "",
const string& onfocus = "",
const string& onselect = "",
const string& tooltip = "",
bool readonly = false) const;

void inputpasswd(const string& name,
const string& value = "",
const string& Class = "",
const string& size = "",
const string& maxlen = "",
const string& onselect = "") const;

void inputcheck(const string& name,
const string& value,
bool checked = false,
const string& onclick = "",
const string& Class = "") const;

void textarea(const string& name,
const vector
& text,
const string& cols,
const string& rows = "",
const string& onblur = "",
const string& onchange = "",
const string& onfocus = "",
const string& onselect = "",
bool readonly = false,
const string& tooltip = "") const;

void inputimage(const string& src,
const string& name = "",
const string& Class = "") const;

void select(const string& name,
bool multiple = false,
const string& Class = "",
const string& size = "",
const string& onblur = "",
const string& onchange = "",
const string& onclick = "",
const string& onfocus = "",
const string& tooltip = "");
void selectend( );

void selectoption(const string& value,
const string& text,
bool selected = false) const;

void inputreset(const string& name,
const string& label,
const string& onclick,
const string& Class,
const string& size = "") const;

html tables

void table(const string& id = "",
const string& Class = "");
void tableend( );
void tr(const string& id = "",
const string& Class = ""); //row void trend( ); // close the tr tag void td(const string& id = "",
const string& Class = "",
const string& value = ""); // data void tdend( ); // close the td tag

basic html tags

void link(const string& href,
const string& linktext,
const string& onclick = "",
const string& id = "",
const string& onmouseout = "",
const string& onmouseover = "",
bool ReplaceCurrentHistoryItem = false) const;

void image(const string& src,
const string& alt,
const string& width = "",
const string& height = "",
const string& id = "",
const string& onmouseout = "",
const string& onmouseover = "",
const string& tooltip = "") const;

void script(const string& code = "",
const string& type = "text/javascript") const;

void p(const string& id = "",
const string& Class = ""); // paragraph void pend( );
void div(const string& id = "",
const string& Class = ""); // div tag void divend( );

void comment(const string& comment) const;
void bold(const string& boldedtext) const; // bold void br( ) const; // line break void space( ) const; // non breaking space

html headings 1-6

void h1(const string& text, const string& id, const string& class) const;
void h2(const string& text, const string& id, const string& class) const;
void h3(const string& text, const string& id, const string& class) const;
void h4(const string& text, const string& id, const string& class) const;
void h5(const string& text, const string& id, const string& class) const;
void h6(const string& text, const string& id, const string& class) const;

stream the built in types. now we can do: xhtmlObject << 10 << " hello world";

xhtml operator<<(const char* in);
xhtml operator<<(const string& in);
xhtml operator<<(char in);
xhtml operator<<(int in);
xhtml operator<<(short in);
xhtml operator<<(long in);
xhtml operator<<(__int64 in);
xhtml operator<<(float in);
xhtml operator<<(double in);
xhtml operator<<(long double in);
xhtml operator<<(unsigned int in);
xhtml operator<<(unsigned short in);
xhtml operator<<(unsigned long in);
cookie functions
example setting a cookie to expire 3 days from now:
long t = 60 * 60 * 24 * 3; // 3 days cgiobject.SetCookie("clientname", "thename", t); 
bool SetCookie(const string& cookie_name,
const string& value,
const long& expires,
const string& path = "",
const string& domain = "",
bool secure = false) const;
returns a cookie value if it exists

bool GetCookie(const CGI& cgi, const string& name, string& value) const;

Delete a cookie already set

void DeleteCookie(const string& cookiename, const string& path ="", const string& domain="") const;

For a complete explanation of xhtml:- html draft standard (W3C)