Difference between revisions of "Ns adp parse"

From AOLserver Wiki
Jump to navigation Jump to search
(imported from WiKit id 867)
 
Line 9: Line 9:
 
'''SYNOPSIS'''
 
'''SYNOPSIS'''
  
: '''ns_adp_parse''' ''?-file|-string? arg ?arg ...?''
+
: '''ns_adp_parse''' ''?-file|-string? ?-safe? arg ?arg ...?''
  
 
'''DESCRIPTION'''
 
'''DESCRIPTION'''
Line 20: Line 20:
  
 
: If you use the ''-file'' syntax, then ''arg'' is the absolute path to the file containing the ADP to be parsed.
 
: If you use the ''-file'' syntax, then ''arg'' is the absolute path to the file containing the ADP to be parsed.
 +
 +
: If you specify the ''-safe'' flag, then only registered tags are executed; inline scripts using "<% ... %>" or "<%= ... %>" are ignored. 
  
 
: You can pass optional arguments to the ADP.  The arguments can be accessed within the ADP using the [[ns_adp_argc]], [[ns_adp_argv]] and [[ns_adp_bind_args]] commands.
 
: You can pass optional arguments to the ADP.  The arguments can be accessed within the ADP using the [[ns_adp_argc]], [[ns_adp_argv]] and [[ns_adp_bind_args]] commands.

Revision as of 19:28, 24 September 2007

Man page: http://aolserver.com/docs/tcl/ns_adp_parse.html


NAME

ns_adp_parse - Parse an ADP file or string and return its output

SYNOPSIS

ns_adp_parse ?-file|-string? ?-safe? arg ?arg ...?

DESCRIPTION

This command processes an ADP from either a file or a string, returning the output. The first arg specifies the filename or contains the string to parse, depending on -file or -string.
If you need to process a second ADP from inside an ADP, it is usually better to use ns_adp_include, because that command resolves relative pathnames passed to it. Also note that ns_adp_parse will ignore any directives to turn on streaming. Tcl_Eval() is used to evaluate the Tcl commands in the ADP.
If you use the -string syntax, then arg is a string containing ADP syntax to be parsed. Note that when you call this command with the -string syntax from inside an ADP, the string cannot contain the "<% ... %>" syntax. The -string syntax is the default.
If you use the -file syntax, then arg is the absolute path to the file containing the ADP to be parsed.
If you specify the -safe flag, then only registered tags are executed; inline scripts using "<% ... %>" or "<%= ... %>" are ignored.
You can pass optional arguments to the ADP. The arguments can be accessed within the ADP using the ns_adp_argc, ns_adp_argv and ns_adp_bind_args commands.
If this call is a nested ADP evaluation (where one ADP calls another), an error will be thrown if the depth exceeds 256, the maximum number of nested ADP evaluations.

EXAMPLES

   % ns_adp_parse -string {<% return expr 2 + 2 %>}
   4
   % ns_adp_parse -file ns_info pageroot/index.adp
   ... output of index.adp ...

SEE ALSO

ns_adp_abort, ns_adp_append, ns_adp_argc, ns_adp_argv, ns_adp_bind_args, ns_adp_break, ns_adp_debug, ns_adp_debuginit, ns_adp_dir, ns_adp_dump, ns_adp_eval, ns_adp_exception, ns_adp_include, ns_adp_mime, ns_adp_mimetype, ns_adp_puts, ns_adp_registeradp, ns_adp_registerproc, ns_adp_registertag, ns_adp_return, ns_adp_safeeval, ns_adp_stats, ns_adp_stream, ns_adp_tell, ns_adp_trunc

Category Documentation - Category Core Tcl API