inc

Adds the code from an include resource to the page.

This function does the same thing as the include keyword, except that it can take an Idoc Script variable as the parameter. See Keywords Versus Functions for more information.

Type and Usage

Parameters

The only parameter is a variable that defines the name of an include.

Output

Displays the code that is defined in the specified include resource.

Example

Say you wanted 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 Also