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.
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.