The following keywords have special meaning in Idoc Script:
|#active||<$#active.variable$>||Retrieves the value of the specified variable from the DataBinder, searching in the following default order:
Does not send an error report to the debug output if the variable is not found.
|#local||<$#local.variable$>||Retrieves the value of the specified variable from the local data. Does not send an error report to the debug output if the variable is not found.|
|#env||<$#env.variable$>||Retrieves the value of the specified variable from the environment settings. Does not send an error report to the debug output if the variable is not found.|
|exec||<$exec expression$>||Executes an expression and suppresses the output (does not display the expression on the page).
In earlier versions of Idoc Script, the exec keyword was required to suppress the value of any variable from appearing in the output file. In the current version, the exec keyword is needed only to suppress an expression from appearing in the output file.
|include||<$include ResourceName$>||Includes the code from the specified resource. See "Includes" for more information.|
|super||<$include super.<include>$>||Starts with the existing version of the include code. See "Super Tag" for more information.|
Content Server pages use the include and exec Special Keywords and the inc and eval Functions extensively. This section describes the differences between these commands and gives examples of how to use them.
The include and exec keywords are standalone commands that operate on defined parameters, but cannot take a variable as a parameter. The inc and eval functions have similar purposes, but they can take variables for parameters, which enables you to dynamically create Idoc Script code depending on the value of the variables.
The following sections describe these keywords and functions in detail:
The exec keyword executes an Idoc Script expression and suppresses the output (does not display the expression on the page). It is primarily used to set variables without writing anything to the page.
In earlier versions of Idoc Script, the exec keyword was required to suppress the value of any variable from appearing in the output file. In the current version, the exec keyword is needed only to suppress an expression from appearing in the output.
For example, the first line below is equivalent to the last two lines:
<$varA="stringA", varB ="stringB"$> <$exec varA="stringA"$> <$exec varB="stringB"$>
See exec for more information.
The eval function evaluates an expression as if it were actual Idoc Script.
In the following example, a variable named one is assigned the string Company Name, and a variable named two is assigned a string that includes variable one.
<$one="Company Name"$> <$two="Welcome to <$one$>"$> <$one$><br> <$two$><br> <$eval(two)$>
In the page output, variable one presents the string
Company Name, variable two presents the string
Welcome to <$one$>, and the function eval(two) presents the string
Welcome to Company Name.
Note that the string to be evaluated must have the Idoc Script delimiters <$ $> around it, otherwise it will not be evaluated as Idoc Script.
Also note that too much content generated dynamically in this manner can slow down page display. If the eval function is used frequently on a page, it may be more efficient to put the code in an include and use the inc Function in conjunction with the eval function.
See eval for more information.
The include keyword is the standard way in which chunks of code are incorporated into the current page. Because include is a keyword, it cannot take a variable as a parameter-the parameter must be the name of an include that already exists.
The inc function does the same thing as the include keyword, except that it can take a variable as the parameter. This function is most useful for dynamically changing which include will be used depending on the current value of a variable.
For example, say you want to execute some Idoc Script for some, but not all, of your custom metadata fields. You could dynamically create includes based on the field names (such as specific_include_xComments) by executing this Idoc Script:
<$loop DocMetaDefinition$> <$myInclude = "specific_include_" & dName$> <$exec inc(myInclude)$> <$endloop$>
Note the use of the exec Keyword, which suppresses the output of the include specified by the inc function. If you don't use exec before the inc function, the HTML inside the specified include will be displayed on the page.
Note that if the specific_include_xComments does not exist, this code will not throw an error because the output is not being displayed.
See inc for more information.