wwUtils::MergeText

This function provides an evaluation engine for FoxPro expressions and code blocks in a template/script page. Default syntax format uses ASP style tags (<% %>), but can work with any set of delimiters.

This parsing engine is faster than TEXTMERGE and provides extensive error checking and the ability to run dynamically in the VFP runtime (ie uncompiled). Embed any valid FoxPro expressions using

   <%= Expression%>

and any FoxPro code with

   <% CodeBlock %>

Expressions ideally should be character for optimal speed, but other values are converted to string
automatically. Although optimized for the delimiters above you may specify your own. Make sure to set the llNoAspSyntax parameter to .t. to disallow the = check for expressions vs code. If you use your own parameters you can only evaluate expressions OR you must use ASP syntax and follow your deleimiters with an = for expressions.

MergeText evaluates each code block individually and you cannot spread structured statements across multiple code blocks. For more complex scripts that compile and run as a single FoxPro PRG file please check out the RenderAspScript() function.

o.MergeText(tcString,tcDelimiter, tcDelimiter2, llNoASPSyntax)

Return Value

expanded string.

Parameters

tcString
Text to be merged. Any expressions and PUBLIC or PRIVATE variables will be evaluated into the merged text.

tcDelimiter
Optional - Script tag start delimiter. Default: <%

tcDelimiter2
Optional - Script tag end delimiter. Default: %>

llNoASPSyntax
Set to .T. if you're not using ASP syntax which can use an <%= to direct eval.

Remarks

Any script errors are embeded like this:

< % ERROR: <expressions> % >

Requires the wwEval class. In fact you'll get better performance by using wwEval::MergeText() directly.


See also:

Library wwUtils | wwUtils::RenderAspScript

© West Wind Technologies, 2023 • Updated: 07/30/10
Comment or report problem with topic