NAME
::html - Procedures to generate HTML structures.
SYNOPSIS
_________________________________________________________________
html::author author
html::bodyTag args
html::cell param value {tag td}
html::checkbox name value
html::checkSet key sep list
html::checkValue name {value 1}
html::closeTag
html::default key {param {}}
html::description description
html::end
html::eval arg ?args?
html::extractParam param key {val ""}
html::font args
html::for start test next body
html::foreach varlist1 list1 ?varlist2 list2 ...? body
html::formatCode code
html::formValue name {defvalue {}}
html::getFormInfo args
html::getTitle
html::h level string {param {}}
html::h1 string {param {}}
html::h2 string {param {}}
html::h3 string {param {}}
html::h5 string {param {}}
html::h6 string {param {}}
html::hdrRow args
html::head title
html::headTag string
html::if expr1 body1 ?elseif expr2 body2 ...? ?else bodyN?
html::keywords args
html::mailto email {subject {}}
html::meta args
html::minorMenu list {sep { | }}
html::openTag tag args
html::passwordInput {name password}
html::passwordInputRow label {name password}
html::quoteFormValue value
html::radioSet key sep list
html::radioValue name value
html::refresh seconds {url {}}
html::init {nvlist {}}
html::row args
html::select name param choices {current {}}
html::selectPlain name param choices {current {}}
html::set var val
html::submit label {name submit}
html::tableFromArray arrname {param {}} {pat *}
html::tableFromList querylist {param {}}
html::textarea name {param {}} {current {}}
html::textInputRow label name args
html::title title
html::varEmpty name
html::while test body
_________________________________________________________________
DESCRIPTION
The ::html package provides commands that generate HTML.
These commands typically return an HTML string as their
result. In particular, they do not output their result to
stdout.
The html::init procedure should be called early to ini
tialize the module. You can also use this procedure to
define default values for HTML tag parameters.
html::author author
Side effect only. Call this before html::head to
define an author for the page. The author is noted
in a comment in the HEAD section.
html::bodyTag args
Generate a BODY tag. The tag parameters are taken
from args or from the body.* attributes define with
html::init
html::cell param value {tag td}
Generate a TD (or TH) tag, a value, and a closing
TD (or TH) tag. The tag parameters come from param
or TD.* attributes defined with html::init. This
uses html::font to insert a standard FONT tag into
the table cell.
html::checkbox name value
Generate a CHECKBOX form element with the specified
name and value. This uses html::checkValue.
html::checkSet key sep list
Generate a set of CHECKBOX form elements and asso
ciated labels. The list should contain an alter
nating list of labels and values. This uses
html::checkbox.
Generate the "name=name value=val for a CHECKBOX
form element. If the CGI variable name has the
value val, then SELECTED is added to the return
value.
html::closeTag
Pop a tag off the stack created by html::openTag
and generate the corresponding close tag (e.g.,
/BODY)
html::default key {param {}}
This procedure is used by html::tagParam to gener
ate the name, value list of parameters for a tag.
The html::default procedure is used to generate
default values for those items not already in
param. If the value identified by key matches a
value in param then this procedure returns the
empty string. Otherwise, it returns a parame
ter=value string for a form element identified by
key. The key has the form tag.parameter (e.g.,
body.bgcolor). Use html::init to register default
values.
html::description description
Side effect only. Call this before html::head to
define a description META tag for the page. This
tag is generated later in the call to html::head.
html::end
Pop all open tags from the stack and generate the
corresponding close HTML tags, (e.g.,
</body></html>).
html::eval arg ?args?
This procedure is similar to the built-in Tcl eval
command. The only difference is that it returns ""
so it can be called from an HTML template file
without appending unwanted results.
html::extractParam param key {varName ""}
This is a parsing procedure that extracts the value
of key from param, which is a HTML-style name=quot
edvalue list. varName is used as the name of a Tcl
variable that is changed to have the value found in
the parameters. The function returns 1 if the
parameter was found in param, otherwise it returns
0. If the varName is not specified, then key is
html::font args
Generate a standard FONT tag. The parameters to
the tag are taken from args and the HTML defaults
defined with html::init.
html::for start test next body
This procedure is similar to the built-in Tcl for
control structure. Rather than evaluating the
body, it returns the subst'ed body. Each iteration
of the loop causes another string to be concate
nated to the result value.
html::foreach varlist1 list1 ?varlist2 list2 ...? body
This procedure is similar to the built-in Tcl fore
ach control structure. Rather than evaluating the
body, it returns the subst'ed body. Each iteration
of the loop causes another string to be concate
nated to the result value.
html::formValue name {defvalue {}}
Return a name and value pair, where the value is
initialized from existing CGI data, if any. The
result has this form:
name="fred" value="freds value"
html::getFormInfo args
Generate hidden fields to capture form values. If
args is empty, then hidden fields are generated for
all CGI values. Otherwise args is a list of string
match patterns for form element names.
html::getTitle
Return the title string, with out the surrounding
TITLE tag, set with a previous call to html::title.
html::h level string {param {}}
Generate a heading (e.g., H1) tag. The string is
nested in the heading, and param is used for the
tag parameters.
html::h1 string {param {}}
Generate an H1 tag. See html::h
Generate an H2 tag. See html::h
html::h3 string {param {}}
Generate an H3 tag. See html::h
html::h4 string {param {}}
Generate an H4 tag. See html::h
html::h5 string {param {}}
Generate an H5 tag. See html::h
html::h6 string {param {}}
Generate an H6 tag. See html::h
html::hdrRow args
Generate a table row, including TR and TH tags.
Each value in args is place into its own table
cell. This uses html::cell.
html::head title
Generate the HEAD section that includes the page
TITLE. If previous calls have been made to
html::author, html::keywords, html::description, of
html::meta then additional tags are inserted into
the HEAD section. This leaves an open HTML tag
pushed on the stack with openTag.
html::headTag string
Save a tag for inclusion in the HEAD section gener
ated by html::head. The string is everything in
the tag except the enclosing angle brackets, < >.
html::if expr1 body1 ?elseif expr2 body2 ...? ?else bodyN?
This procedure is similar to the built-in Tcl if
control structure. Rather than evaluating the body
of the branch that is taken, it returns the
subst'ed body. Note that the syntax is slightly
more restrictive than that of the built-in Tcl if
control structure.
html::keywords args
Side effect only. Call this before html::head to
define a keyword META tag for the page. The META
tag is included in the result of html::head.
html::mailto email {subject {}}
Generate a hypertext link to a mailto: URL.
Side effect only. Call this before html::head to
define a META tag for the page. The args is a Tcl-
style name, value list that is used for the name=
and value= parameters for the META tag. The META
tag is included in the result of html::head.
html::minorMenu list {sep { | }}
Generate a series of hypertext links. The list is
a Tcl-style name, value list of labels and urls for
the links. The sep is the text to put between each
link.
html::openTag tag args
Push tag onto a stack and generate the opening tag
for tag. Use html::closeTag to pop the tag from
the stack.
html::passwordInput {name password}
Generate an INPUT tag of type PASSWORD.
html::passwordInputRow label {name password}
Format a table row containing a label and an INPUT
tag of type PASSWORD.
html::quoteFormValue value
Quote special characters in value by replacing them
with HTML entities for quotes, ampersand, and angle
brackets.
html::radioSet key sep list
Generate a set of INPUT tags of type RADIO and an
associated text label. All the radio buttons share
the same key for their name. The sep is text used
to separate the elements. The list is a Tcl-style
label, value list.
html::radioValue name value
Generate the "name=name value=val for a RADIO form
element. If the CGI variable name has the value
val, then SELECTED is added to the return value.
html::refresh seconds url
Set up a refresh META tag. Call this before
html::head and the HEAD section will contain a META
seconds. The url is optional. If specified, it
specifies a new page to load after the refresh
interval.
html::init {list {}}
html::init accepts a Tcl-style name-value list that
defines values for items with a name of the form
tag.parameter. For example, a default with key
body.bgcolor defines the background color for the
BODY tag.
html::row args
Generate a table row, including TR and TD tags.
Each value in args is place into its own table
cell. This uses html::cell.
html::select name param choices {current {}}
Generate a SELECT form element and nested OPTION
tags. The name and param are used to generate the
SELECT tag. The choice list is a Tcl-style name,
value list.
html::selectPlain name param choices {current {}}
Like html::select except that choices is a Tcl list
of values used for the OPTION tags. The label and
the value for each OPTION are the same.
html::submit label {name submit}
Generate an INPUT tag of type SUBMIT.
html::set var val
This procedure is similar to the built-in Tcl set
command. The main difference is that it returns ""
so it can be called from an HTML template file
without appending unwanted results. The other dif
ference is that it must take two arguments.
html::tableFromArray arrname {param {}} {pat *}
Generate a TABLE and nested rows to display a Tcl
array. The param are for the TABLE tag. The pat
is a string match pattern used to select array ele
ments.
html::tableFromList querylist {param {}}
Generate a TABLE and nested rows to display
querylist, which is a Tcl-style name, value list.
The param are for the TABLE tag.
Generate a TEXTAREA tag wrapped around its current
values.
html::textInput name args
Generate an INPUT form tag with type TEXT. This
uses html::formValue. The args is any additional
tag attributes you want to put into the INPUT tag.
html::textInputRow label name args
Generate an INPUT form tag with type TEXT formatted
into a table row with an associated label. The
args is any additional tag attributes you want to
put into the INPUT tag.
html::title title
Side effect only. Call this before html::head to
define the TITLE for a page.
html::varEmpty name
This returns 1 if the named variable either does
not exist or has the empty string for its value.
html::while test body
This procedure is similar to the built-in Tcl while
control structure. Rather than evaluating the
body, it returns the subst'ed body. Each iteration
of the loop causes another string to be concate
nated to the result value.
SEE ALSO
ncgi
KEYWORDS
html, form, table, checkbox, radiobutton, checkbutton
Man(1) output converted with
man2html