wwUtils::RenderAspScript

Allows quick rendering of an ASP style script page that contains embedded <% %> tags for FoxPro script expressions and code blocks. Runs as a full FoxPro program.

Unlike MergeText, this function can execute structured code blocks like this:

<% if lnQty > 5 %>
   Qty: <%= lnQty %>
<% else %>
   Minimal Qty: <%= lnQty %>
<% endif %>

The script template is compiled into a single FoxPro PRG file that is executed so the entire script page acts like a single self contained function with Function scope.

RenderAspScript is a thin wrapper around the wwScripting class to provide single line execution of scripts.

o.RenderAspScript(lcTemplate,lnMode,llIsString,llUseHttpResponse)

Parameters

lcTemplate
The template file to execute OR the string content of the template if llIsString is .T.

lnMode
1 - Dynamic Compilation (compile as needed)
2 - Precompiled (FXP file executed)
3 - ExecScript (run from memory)

See: wwServer::nScriptMode

llIsString
If .t. specifies the lcTemplate is the actual template text rather than a filename. Note that if you pass the template as a string lnMode is overridden to use 3 - ExecScript.

llUseHttpResponse
If .T. uses the wwScriptingHttpResponse object so that HTTP headers can be set and returned. Note that if your script uses any header access this flag needs to be set.


See also:

Library wwUtils | wwUtils::MergeText | wwServer::nScriptMode

© West Wind Technologies, 1996-2019 • Updated: 08/28/06
Comment or report problem with topic