NaviServer - programmable web server
4.99  5.0

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

ns_adp_include(n) 4.99.30 naviserver "NaviServer Built-in Commands"

Name

ns_adp_include - Parse an ADP file and return its output

Table Of Contents

Synopsis

Description

This command parses the specified file as an ADP, including the text blocks and any output generated by script blocks in the current output buffer. The execution occurs in a new call frame with private local variables similar to a Tcl procedure. The filename is the file containing the ADP to be parsed. If the file is not an absolute filename, the file is considered relative to the current ADP working directory which is the directory of the previously included file. The optional -cache interval argument specifies the time to cache the results of execution. All output generated by any scripts and included ADP's are saved for subsequent requests unless an included ADP has a -nocache option. The use of -cache and -nocache can be used to increase performance of ADP used to generated a mix of personalized, non-cacheable, content and shared content which changes more slowly. Under high load, the performance improvement can be substantial, especially in cases where the cached content is the result of accessing a slow databases or web services.

ADPs can be nested by including each other up to the maximum of 256 levels deep.

This command is only applicable while parsing an ADP file. Use ns_adp_parse to parse ADPs from outside the context of an ADP.

COMMANDS

ns_adp_include ?-cache seconds? ?-nocache? ?-tcl? file ?arg ...?

-cache interval This optional argument specifies the time to cache the results of execution (i.e. the output written to the ADP buffer). The interval can be specified with a time unit.

-nocache Do not cache ADP page results.

-tcl Given argument is a .tcl file and should be wrapped into ADP page.

EXAMPLES

 ###
 ### Example: ADP file a.adp includes adp-file b.adp
 ###
 
 # In a.adp:
 begin of a.adp<br>
 <% ns_adp_include b.adp %>
 end of a.adp<br>
 
 # In b.adp:
 begin of b.adp<br>
 ...<br>
 <% ns_adp_puts "Hello, world!" %><br>
 ...<br>    
 end of b.adp<br>

See Also

ns_adp, ns_adp_abort, ns_adp_append, ns_adp_argc, ns_adp_argv, ns_adp_bind_args, ns_adp_break, ns_adp_debug, ns_adp_dir, ns_adp_dump, ns_adp_exception, ns_adp_mime, ns_adp_mimetype, ns_adp_parse, ns_adp_puts, ns_adp_register, ns_adp_return, ns_adp_stats, ns_adp_stream, ns_adp_tell, ns_adp_trunc, ns_time

Keywords

ADP