Class wwScripting

The wwScripting class provides a simple mechanism for executing ASP style <% %> script pages containing Visual FoxPro code. The class provides a mechanism for dynamically executing script templates including full semantics for compilation and runtime version checking to provide optimal execution performance as pure FoxPro code.

The class also has support for:

  • Layout Pages (master page that content pages can load into)
  • Partial Pages (child pages that get loaded into a parent page)

Code execution runs against ASP style script which can evaluate script expressions (< %= and % >) and full code blocks (< % and % >). The script parser converts templates into pure FoxPro PRG file source code that is executed on disk using the RenderAspScript() method or from memory using the ExecScript() method (more limited).

The wwScripting class is used as the script parser for Response.ExpandScript and generic script execution in the Web Connection Framework.


Class Members



Compiles an ASP script template into PRG and FXP files if needed. If the FXP file exists and is newer than the script file, no compilation is performed.



This method is used to execute a script template using the FoxPro ExecScript command. This method can accept input from a file or from a string that holds the ASP style template.

o.ExecScript(lcTemplate as string, llIsCodeString)


Provides Template parsing for expression evaluated tempaltes. Unlike script pages, MergeText evaluates pages by parsing each script block individually and executing the code contained in it. Uses EVALUATE for <%= %> expressions and EXECSCRIPT for <% %> blocks.



Renders an ASP style page as a compiled VFP program. This method handles creation of the VFP source code from the script file, compilation and checking for updates of the file.



A base property used for partials, and layout pages with ~/ is used in the path. Set this value to the path that identifies ~/.


Path where our compiled FXP and WCT files are stored. Defaults to the same path as the template.


This property can be used to display the top of the error message page should a scripting error occur.


An error message if the script execution fails. Also set is the lError property.


The input script code saved to a variable.


The Response class used for script processing.
  • wwScriptingResponse
    This is the default Response class used that provides the base functionality. It includes functionality for writing output and clearing output.


The generated VFP code saved for you to review.


If .T. pops up an editor window for editing the error in the code.


Error flag that can and should be checked after running a script or template. You can also check the cErrorMsg property for a string error message.


If .T. doesn't check or attempt to compile the file, but just executes the FXP. Assumes the FXP exists and fails if it does not exist.


If .t. doesn't delete the generate VFP source code after compiling


If .T. displays full error information on the page if possible


Flag used to cause parser to stop on the line of code causing error in VFP


If set to .T. throws errors as exceptions when lStopOnError = .F.


A VFP 8/9 Exception object which is set when an error occurs. Usually you don't need to look at this as the cErrorMesage


Assembly: wwscripting.prg

See also:

wwPageResponse::ExpandScript | wwServer::nScriptMode | Templates and Scripts - MVC for Web Connection

© West Wind Technologies, 1996-2024 • Updated: 05/04/2021
Comment or report problem with topic