Technical data
8. Documentation for Developers
The Function show_tab_header
For good looking content of your generated webpage generated by the CGI you may use the
cgi-helper function show_tab_header. It creates clickable “Tabs” in order to present your
page divided into multiple logically separated areas.
Parameters are always passed in pairs to the show_tab_header function. The first value
reflects the title of a tab, the second reflects the link. If the string “no” is passed as a link only
the title will be created and the tab is not clickable (and blue).
In the following example a “window” with the title “A great window” is generated. In the
window is “foo bar”:
show_tab_header "A great window" "no"
echo "foo"
echo "bar"
show_tab_footer
In this example, two clickable selection tabs are generated that pass the variable action to
the script, each with a different value.
show_tab_header "1st selection tab" "$myname?action=dothis" \
"2nd selection tab" "$myname?action=dothat"
echo "foo"
echo "bar"
show_tab_footer
Now the script can change the content of the variable FORM_action (see variable evaluation
below) and provide different content depending on the selection. For the clicked tab to appear
selected and not clickable anymore, a “no” would have to be passed to the function instead of
the link. But there is an easier way, if you hold to the convention in the following example:
_opt_dothis="1st selection tab"
_opt_dothat="2nd selection tab"
show_tab_header "$_opt_dothis" "$myname?action=opt_dothis" \
"$_opt_dothat" "$myname?action=opt_dothat"
case $FORM_action in
opt_dothis) echo "foo" ;;
opt_dothat) echo "bar" ;;
esac
show_tab_footer
Hence, if a variable whose name equals the content of the variable action with a leading
underscore (_) is passed as the title then the tab will be displayed selected.
The Function show_tab_footer
The function show_tab_footer closes the block in the CGI script that was opened by the
function show_tab_header.
327










