Not a question, just thought I would share it. I've been using C for cgi programming for a while, I'm just now getting a real grip on C++. Anyway, I'm working on a "page" class, with methods that make HTML items...
I'm just starting out with this. I plan to add forms, tables, and maybe dynamic data...
I'm thinking of making a few versions that support different DTD's when I'm done.Code:#include <iostream> using namespace std; class Page{ public: Page(); ~Page(); void div(char *style, char *contents); void pr(char* prdata); void pgfoot(); private: int pgid; }; Page::Page(){ pgid=1; cout<<"Content-type: text/html\n\n"; cout<<"<html>\n<head />\n<body>"<<endl; } Page::~Page(){ } void Page::div(char *style, char *contents){ cout << "<div style=\'"<<style<<"\'>" << endl; cout << contents << "</div>" << endl; } void Page::pr(char* prdata){ cout << prdata<<endl; } void Page::pgfoot(){ cout <<"</body>"<<endl; cout <<"</html>"<<endl; } int main(){ Page pg; pg.div("color:#00cc99;background-color:#ccccff;","<p>It works!</p>"); pg.pgfoot(); return 0; }



LinkBack URL
About LinkBacks



