The need for these functions is obviated for the most part by the existence of templates, but sometimes is useful to insert HTML directly into the document. This code provides a front end so you don't have a boatload of ugly htprintf's.
- void preHTML (void)
- void startHTML (char * title, char * base)
- void endHTML (void)
- void formHTML (char * method, char * action, char * parm)
- void endformHTML (void)
- void selectHTML (char * name, char * label, char ** vec, char * selected)
- void optionHTML (char * val, char * txt, int selected)
- void radioHTML (char * name, char * label, char ** vec, char * selected)
- void checkHTML (char * name, char * label, char * valtag, char * val)
- void inputHTML (char * label, char * name, char * value enum itype type, int size, int maxsize)
- void textHTML (char * label, char * name, char * val, int cols, int rows)
- void aHTML (char * url, char * txt)
- void endaHTML (void)
- void dl (int on)
- void dt (void)
- void dd (void)
- void pre (int on)
- void center (int on)
- void br (int n)
- void par (void)
- void bq (int n)
- void hr (void)
- void hl (int n)
- void ul (int on)
- void ol (int on)
- void li ()
- void preHTML (void)
- This function should be the very first function called. It contains the essential MIME headers, which if not present will cause the HTTPD spaz out (not to mention the browser). If you need to insert your own MIME headers, consider using hthdrprintf () which will simplify your life.
- void startHTML (char * title, char * base)
- If you need to start a page by hand, this will add the normal header kruft. Base is where relative links will be referenced from, which is usually useful for CGI programs.
- void endHTML (void)
- End the document.
- void formHTML (char * method, char * action, char * parm)
- Start a form using method (GET|POST) and a URL in action. parm is an optional parameter to give to the action.
- void endformHTML (void)
- End the form.
- void selectHTML (char * name, char * label, char ** vec, char * selected)
- Add a select box to the current document.
- name: the name of the field
- label: an optional text label to put in front of the field
- vec: a null terminated array of pointers to character strings which represents the choices
- selected: a string representing the selection which is selected. If there is no current selection, the first field will be selected.
- void optionHTML (char * val, char * txt, int selected)
- Create an option tag. Val is its value, txt is the text of the option (ie what the user sees), and selected is whether it should be selected.
- void radioHTML (char * name, char * label, char ** vec, char * selected)
- Similar to selectHTML(), create a set of radio style checkboxes.
- name: the name of the field
- label: an optional text label to put in front of the field
- vec: a null terminated array of pointers to character strings which represents the choices
- selected: a string representing the selection which is selected. If there is no current selection, the first field will be selected.
- void checkHTML (char * name, char * label, char * valtag, char * val)
- Create a checkbox input field. Similar to a radio box, however this routine only creates one checkbox element at a time, with valtag controlling whether it's currently pressed.
- void inputHTML (char * label, char * name, char * value enum itype type, int size, int maxsize)
- Create an input type HTML tag.
- label: an optional text label to preceed the field.
- name: the name of the field
- value: the value of the field
- type: one of (text, hidden, submit, reset, radio, checkbox, password)
- size: size of the box
- maxsize: the maximum size of the box.
- void textHTML (char * label, char * name, char * val, int cols, int rows)
- Create a text entry box.
- label: an optional label which precedes the box
- name: the name field of the box
- val: a string of the contents of the box.
- rows: the number of rows in the box
- cols: the number of columns in the box
- void aHTML (char * url, char * txt)
- Create an anchor tag for the given url. If txt is included, it will be inserted along with the end tag.
- void endaHTML (void)
- insert an end anchor tag.
- void dl (int on)
- start or end a dl.
- void dt (void)
- start a dt.
- void dd (void)
- start a dd.
- void pre (int on)
- start or end preformatted text.
- void center (int on)
- start centering text.
- void br (int n)
- insert n breaks.
- void par (void)
- insert a paragraph.
- void bq (int n)
- insert n blockquotes. Negative numbers insert the corresponding number of end tags.
- void hr (void)
- insert a horizontal rule.
- void hl (int n)
- insert a header of size n. Negative number insert the corresponding end tag.
- void ul (int on)
- start/finish an unordered list
© (copyright) 1997 MTCC Last modified: Fri Apr 25 20:40:43 PDT 1997