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.

Custom
  wwScripting

Class Members

MemberDescription

CompileAspScript

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.

o.CompileAspScript(lcTemplate)

ExecScript

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)

MergeText

o.wwScripting.MergeText(lcText,llIsFile)

RenderAspScript

o.RenderAspScript(lcTemplate)

cBasePath

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

cCompiledPath

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

cErrorHeader

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

cErrorMsg

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

cScriptCode

The input script code saved to a variable.

cScriptResponseClass

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.

cVFPCode

The generated VFP code saved for you to review.

lEditErrors

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

lError

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.

lNoVersionCheck

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.

lSaveVfpSourceCode

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

lShowFullErrorInfo

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

lStopOnError

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

lThrowException

oException

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

Requirements

Assembly: wwscripting.prg

See also:

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

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