Ns adp registeradp
Jump to navigation
Jump to search
Man page: http://aolserver.com/docs/devel/tcl/api/adp.html#ns_adp_registertag
NAME
- ns_adp_registertag - Register an XML-like tag that executes an ADP script.
SYNOPSIS
- ns_adp_registertag tag ?endtag? adpstring
DESCRIPTION
- ns_adp_registertag registers an ADP script to be called when the specified beginning and ending tags are used in an ADP. The tag is the beginning tag to look for, and the endtag is the ending tag to look for. The adpstring is an ADP that will be called when AOLserver encounters the specified tags when processing an ADP.
- Try not to confuse ns_adp_registertag with ns_register_adptag. This one registers an ADP script that is run by the tag. The other one registers a Tcl proc that is run by the tag.
- Note: This function cannot be called after the server has started. It must be called in a Tcl script in a virtual server's Tcl directory so that it can be initialized at server startup time.
- There are two ways to use ns_adp_registertag, with and without the endtag parameter:
- If the endtag parameter is specified, the string of characters between the beginning tag (tag) and the ending tag (endtag) is passed to the adpstring. The return value of the ADP will be sent to the browser in place of the string of text that was specified between the beginning and ending tags. The string is not parsed, which means that you cannot include ADP tags in the string unless you execute ns_adp_parse on the string inside the ADP that processes the registered ADP tag.
- If endtag is not specified, then no closing tag is required. The ADP will be called every time the specified tag is encountered.
- Note: This function is best used in a .tcl file rather than an .adp file, because the parser will be confused by the <% ... %> syntax even though they are in braces.
EXAMPLES
ns_adp_registertag printdate { The current date is: <% ns_adp_puts [ns_httptime [ns_time]] %> }
- In your HTML, you simply include a tag called "<PRINTDATE>". This can be extended to provide XML-like template pages for content.
SEE ALSO