NaviServer Programmable Web Server

ns_adp_bind_args(n)

NaviServer Built-in Commands – 5.1.0


[ Main Table Of Contents | Table Of Contents | Keyword Index ]

Name

ns_adp_bind_args - Bind ADP arguments to variables

Table Of Contents

Synopsis

Description

This command assigns the arguments of the current ADP invocation to local variables. The arguments are typically provided via ns_adp_include. Each varname is assigned the corresponding argument value, in order. The number of varname parameters must match the number of arguments; otherwise, an error is raised.

The binding starts with the first argument (index 0 of ns_adp_argv). The name of the ADP itself is not included in the argument list.

COMMANDS

ns_adp_bind_args varname ...

Assign the ADP arguments to the specified variables.

EXAMPLES

 # In a.adp:
 <% ns_adp_include b.adp 1 2 3 %>
 # In b.adp:
 <%
   ns_adp_bind_args x y z
   ns_adp_puts "x=$x y=$y z=$z"      ;# => {x=1 y=2 z=3}
 %>

See Also

ns_adp_argc, ns_adp_argv, ns_adp_include, ns_adp_parse, nsd

Keywords

ADP, server built-in