Boris,
There are some ns_ functions that you cannot call from .adp files regardless of OpenACS. ns_adp_puts is one of them. What you have written smells like you have some PHP experience. Try this for a paradigm shift:
<html>
<head>API Tcl Example</head>
<body>
<h1>API Tcl Example</h1>
<p>
Hello
<%
set ua [ns_set get [ns_conn headers] "user-agents"]
%>
<%= $ua %>
<%
if [string match "*MSIE*" $ua] {
set output "This is MS Internet Explorer browser."
} elseif [string match "*Mozilla*" $ua] {
set output "This is Mozilla browser."
} else {
set output "Couldn't determine your browser."
}
%>
<%= $output %>
</body>
</html>
However that being said, the "right" way to do this in OpenACS is to create a hello.tcl file that contains all your set statements, and a hello.adp file that contains the presentation. It might look like this:
hello.tcl
set ua [ns_set get [ns_conn headers] "user-agents"]
if [string match "*MSIE*" $ua] {
set output "This is MS Internet Explorer browser."
} elseif [string match "*Mozilla*" $ua] {
set output "This is Mozilla browser."
} else {
set output "Couldn't determine your browser."
}
hello.adp
<html>
<head>API Tcl Example</head>
<body>
<h1>API Tcl Example</h1>
<p>
Hello
@ua@
@output@
</body>
</html>
Note that then the URL for the page would be http://yoursite/calendar/hello (note lack of .adp or .tcl extension).