9 Idoc Script Extensions

Site Studio uses several Idoc Script extensions that are used to run a web site:

Note:

These script extensions are subject to change with each release of Site Studio.

9.1 About Idoc Script Extensions

Idoc Script is the server-side custom scripting language for Oracle Content Server. It enables you to reference variables, conditionally include content in HTML pages, and loop over results returned from queries.

When a component is installed on Oracle Content Server, the component can add extensions to the Idoc Script and variables, allowing for further customization.

Idoc Script is used primarily for the presentation of HTML templates and configuration settings. The Site Studio component adds a number of script extensions which are described in this section.

9.2 wcmPlaceholder

Description

The wcmPlaceholder() function defines an area on the page that will hold content. The actual content that the placeholder will display depends upon the data file, subtemplate, and other web site objects associated with the placeholder.

Parameters

  • placeholderName: The name of the placeholder. Required.

  • dataFileDocName: The dDocName of the data file to associate with the placeholder.

  • templateDocName: The dDocName of the region template or subtemplate to associate with the placeholder.

  • placeholderDefinitionDocName: The dDocName of the placeholder definition to map to the placeholder.

  • regionDefinitionDocName: The dDocName of the region definition to associate with the region template named in templateDocName.

  • placeholderActions: The allowed actions of the placeholder definition, as follows:

    • E allows contributor update

    • P allows workflow approve

    • R allows workflow reject

    • I allows viewing docInfo

    • S allows switching the data file

    • U allows viewing the web usage report

    • T allows viewing the web tracker report

    • M allows updating the docInfo

    • V allows switching the region template

    • N allows remove content

    Each selection corresponds to the checkbox for the action in the design view of the placeholder definition in Designer.

If you use parameters that do not work together (for example, specifying a subtemplate as well as a region definition), then the script will execute based on the order of parameters listed above.

Code Examples

<!--$wcmPlaceholder("placeholderName")-->

<!--$wcmPlaceholder("placeholderName","dataFileDocName=dDocName", "templateDocName=[region template dDocName|subtemplate dDocName]","placeholderDefinitionDocName=dDocName",
"regionDefinitionDocName=dDocName", placeholderActions=EPRISUTMVN")-->

9.3 wcmElement

Description

The wcmElement() script inserts an element in a region template. The element does not have to be listed in the region definition.

This script allows you to retrieve out of the data file the content associated with the named element. This is only for WYSIWYG, Image, Text, and Custom elements. The content of the element that is inserted will be further evaluated in the scope of the current layout page and therefore can include further server-side Idoc Script, if necessary.

Parameters

  • dDocName: the dDocName of the data file containing the elementName. If a dDocName is not specified, then the current data file associated with the placeholder is used.

  • elementName: The name of the element. Required.

Code Example

<!--$wcmElement("elementName")-->

<!--$wcmElement("dDocName", "elementName")-->

9.4 wcmListStart

Description

This function defines the start of a List element.

Parameters

  • elementName: The name of the list element. Required.

Code Example

<!--$wcmListStart("elementName")-->

9.5 wcmListEnd

Description

This function defines the end of a list element.

Parameters

  • elementName: The name of the list element. Required.

Code Example

<!--$wcmListEnd("elementName")-->

9.6 wcmListElement

Description

This performs the same function as wcmElement but it is for placing static list element content into the region template. This script allows you to retrieve out of the data file the content associated with the named static list element. The content of the element that is inserted will be further evaluated in the scope of the current layout page and therefore can include further server-side Idoc Script, if necessary.

Parameters

  • listName: The name of the list element. If wcmListElement is used between wcmListStart and wcmListEnd then listName can be omitted.

  • elementName: The name of the element within the list used to construct the listElement.

  • rowNum: The row position of the elementName within the listName.

Code Example

<!--$wcmListElement("Wysiwyg", rowNum)-->

The above example uses only elementName and rowNum.

Example within context:

<!--$wcmListStart("StaticList")-->
<!--$wcmListIndex = 0-->
<!--$wcmListNumRows = wcmListRowCount()-->
<table><!--$loopwhile wcmListIndex < wcmListNumRows-->
<tr>
<td><!--$wcmListElement("Wysiwyg", wcmListIndex)--></td>
<td><!--$wcmListElement("plaintext", wcmListIndex)--></td>
</tr>
<!--$wcmListIndex = wcmListIndex + 1-->
<!--$endloop--></table>
<!--$wcmListEnd("StaticList")-->

9.7 wcmListRowCount

Description

This script retrieves the number of rows in the list element. An integer value is returned.

Parameters

  • listName: The name of the list element. If wcmListRowCount is used between wcmListStart and wcmListEnd then listName can be omitted.

Code Example

<!--$wcmListRowCount("listName")-->

Example within context:

<!--$wcmListStart("listName")-->
<!--$wcmListIndex = 0-->
<!--$wcmListNumRows = wcmListRowCount()-->
<table><!--$loopwhile wcmListIndex < wcmListNumRows-->
<tr>
<td><!--$wcmListElement("Wysiwyg", wcmListIndex)--></td>
<td><!--$wcmListElement("plaintext", wcmListIndex)--></td>
</tr>
<!--$wcmListIndex = wcmListIndex + 1-->
<!--$endloop--></table>
<!--$wcmListEnd("listName")-->

9.8 wcmDynamicList

Description

Prepares the service binder for a call to SS_GET_SEARCH_RESULTS by retrieving the search parameters from the named dynamic list element. It returns a Boolean indicating success or failure.

Parameters

  • elementName: The name of the element within the list used to construct the listElement

Returns

This returns a Boolean value indicating success or failure.

Code Example

<!--$wcmDynamicList("elementName")-->

Example within context:

<!--$if wcmDynamicList("dynamicList")-->
<!--$executeService("SS_GET_SEARCH_RESULTS")-->
<!--$loop SearchResults-->
<!--$xml(dDocTitle)--><br />
<!--$endloop-->
<!--$endif-->

9.9 wcmIncludeElement

Description

This script allows the contents of an element to be displayed outside the context of the region. When an element is in the context of a region (that is, in a region template), then there is an implied data file association based on that region template.

With wcmIncludeElement, you can force a data file association when the element is outside the context of a region.

Parameters

  • dDocName: The dDocName for the data file.

  • expression: The XPath expression (to identify a specific node or nodes of the XML data file).

Returns

The contents of the element are returned.

Code Example

queryVal = <!--$wcmIncludeElement("datafiledDocName", "wcm:root/wcm:element[@name='elementName']/node()")-->

9.10 wcmDynamicConversion

Description

Used to create a dynamic conversion of a native document.

Parameters

  • ruleName: The name of the rule as defined in the ConversionsDefinition file. Required.

  • dataFileDocName: The dDocName of the native document to convert.

  • pageNum: The page number within the native document to convert.

  • conversionsDefinitionDocName: The dDocName of the conversion definition.

  • conversionType: Possible type values are simple, full, rule, engine, or command.

  • conversionTemplate: The dDocName of the template. Valid only when using conversionType="full".

  • conversionLayout: The dDocName of the layout. Valid only when using conversionType="full".

  • conversionRuleName: The name of the rule. Valid only when using conversionType="rule".

  • conversionCommand: A piece of Idoc Script executed in the context of the page. Valid only when using conversionType="command".

Returns

The HTML generated by the dynamic conversion based on the parameters.

Code Example

Using the default:

<!--$wcmDynamicConversion("ruleName")-->

Including a type value:

<!--$wcmDynamicConversion("ruleName","dataFileDocName=dDocName","pageNum=number","conversionsDefinitionDocName=dDocName", "conversionType=engine")-->

9.11 wcmGetListAsResultSet

Description

This tag is used to retrieve the static list content, and the content available as a ResultSet.

Parameters

  • dDocName: The dDocName name of the Contributor Data File. If this is omitted the current data file is used.

  • listName: The name of the list element. Required.

  • resultSetName: The name of the ResultSet to create. If this is omitted, the ResultSet name will be the same as the listName.

  • evaluateList: A boolean value indicating if Idoc expressions in the list elements should be evaluated. The default is true.

Returns

This returns a Boolean value indicating success or failure.

Code Example

<!--$wcmGetListAsResultSet("dDocName","List_Element","name_of_ResultSet","false")-->
<!--$wcmGetListAsResultSet("List_Element", "name_of_ResultSet")-->

9.12 wcmFragment

Description

This tag is used on templates to add a fragment. If the tag is used on a region template or subtemplate, only the first drop-point snippet will be used.

Parameters

  • fragmentInstanceId: The ID of the fragment instance on the page. Used to differentiate fragments that have multiple pages of returns, such as dynamic lists. The ID allows the dynamic lists to display different 'pages' of query results. For instance, one fragment can be on page 1 of its query results, while the other can display page 3 of its own results. If the same ID is used for both fragments, then clicking to a particular page of results for one query will cause the other fragment to display the same page number of its own results.

  • fragmentDocName: The dDocName of the fragment library.

  • fragmentId: The ID of fragment within the named library.

  • snippetId: The ID of snippet within the named fragment.

  • tagProperties: The named value pairs of properties of the fragment.

Code Example

<!--$wcmFragment("fragmentInstanceID", "fragmentDocName", "fragmentID", "snippetID", "ssTheme=default", "ssHoverColor=", "ssTextColor=", "ssFocusColor=", "ssShowHome=true", "ssShowNext=false", "ssClassName=IDocNavTabsTop")-->

9.13 wcmUrl

Description

This is a single script which can be used to make all link formats. Legacy sites required three different scripts to generate the different types of links available in Site Studio.

Parameters

  • type: The type of link, entered as one of the following: nodelink, link, resource, or rendition.

    • nodelink is used to create links to sections, which by default end with index.htm.

    • link is used to create links to content, which by default end with contentId.

    • resource is used to link to weblayout static resources, such as images.

    • rendition is used to link to Digital Asset Manager (DAM) renditions.

  • nodeId: the ID of the node referenced. Used only when the type is set to either nodelink or link.

  • siteId: the site ID of the web site referenced. Used only when the type is set to either nodelink or link.

  • dDocName: the dDocName of the content referenced. Used only when the type is set to either link or resource.

  • path: the path to the content referenced. Used only when the type is set to either link or resource.

  • renditionName: the name of the rendition linked to. Used only when the type is set to rendition.

Code Example

Links to sections; by default these links end with index.htm.

<!--$wcmUrl('nodelink',nodeId)-->
<!--$wcmUrl('nodelink',nodeId,siteId)-->

Links to content; by default these links end with a contentId.

<!--$wcmUrl('link','dDocName')-->
<!--$wcmUrl('link','dDocName','nodeId')-->
<!--$wcmUrl('link','dDocName",'nodeId','siteId')-->

Links to weblayout static resources; for example, images.

<!--$wcmUrl('resource','dDocName')-->
<!--$wcmUrl('resource','groups/public/documents/adacct/mydocname.jpg')-->

See also Section 9.40, "ssWeblayoutUrl."

Links to a DAM rendition:

<!--$wcmUrl('rendition', dDocName, 'smallimage')-->

9.14 ssIncludeXml

Description

This script extension is a core Site Studio method that allows any element within a managed XML file to be extracted and returned in an Idoc string variable, which can be placed directly on a web page as an HTML snippet. The content of the XML node that is being extracted will be further evaluated in the scope of the current layout page and therefore can include further server-side Idoc Script, if necessary.

Parameters

  • dDocName: The dDocName of XML data file.

  • expression: XPath expression (to identify a specific node or nodes of the XML data file).

Returns

The content of the element listed in the Xpath.

Code Example

<!--$ssIncludeXml("dDocName", "expression"-->

<!--$ssIncludeXml("dDocName", "wcm:portal/wcm:element[@name = "eleName"]/node()"-->

9.15 ssGetDocInfo

Description

This script extension retrieves a DOC_INFO result set for the named dDocName.

Parameters

  • dDocName: the identifier of the document whose DOC_INFO should be retrieved.

Returns

A boolean value indicating the success of the operation.

Code Example

<!--$ssGetDocInfo("MyDocName")-->

<!--$if ssGetDocInfo("MyDocName")-->
<!--$endif-->

9.16 ssGetXmlNodeCount

Description

This script extension returns a count of the number of repeating instances of a given element within a managed XML file. This is used primarily in the implementation of static list fragments to display a set of repeating contribution elements.

Parameters

  • dDocName: The dDocName of XML data file.

  • expression: XPath expression (to identify a specific node or nodes of the XML data file).

Returns

The integer value of the number of rows in the list.

Code Example

<!--$ssGetXmlNodeCount("dDocName", "expression"-->

<!--$ssGetXmlNodeCount("dDocName", 'wcm:portal/wcm:element[@name = "eleName"]'-->

9.17 ssIncDynamicConversion

Description

This script extension can be used to perform a dynamic conversion of a native document where the resulting HTML is returned in an Idoc string variable that can be placed directly on a web page in the form of an HTML snippet. This method allows the caller to specify the managed conversion template and conversion layout to be used.

Parameters

  • dDocName1: dDocName of native document to convert.

  • dDocName2: dDocName of template to use in conversion.

  • dDocName3: dDocName of layout template to use in conversion.

  • dcPageNum: The page number of the document to convert (optional).

Returns

An HTML string snippet of the document conversion.

Code Example

<!--$ssIncDynamicConversion("dDocName1", "dDocName2", "dDocName3", "3")-->

9.18 ssIncDynamicConversionByRule

Description

This script extension, like the ssIncDynamicConversion extension, can be used to perform a dynamic conversion of a native document where the resulting HTML is returned in an Idoc string variable that can be placed directly on a web page, in the form of an HTML snippet.

Unlike ssIncDynamicConversion, this extension uses a specified rule from the Dynamic Converter rules engine in order to decide which conversion template to use. It therefore does not require the caller to specify a managed conversion template or conversion layout.

Parameters

  • dDocName: The dDocName of native document to convert.

  • rule: The name of Dynamic Converter rule to use.

  • dcPageNum: The page number of the document to convert (optional).

Returns

An HTML string snippet of the document conversion.

Code Example

<!--$ssIncDynamicConversionByRule("dDocName", "rule", "1")-->

9.19 ssIncDynamicConversionByRulesEngine

Description

This script extension, like the ssIncDynamicConversion extension, can be used to perform a dynamic conversion of a native document where the resulting HTML is returned in an Idoc string variable that can be placed directly on a web page, in the form of an HTML snippet.

Unlike ssIncDynamicConversion, this extension uses the normal Dynamic Converter rules engine in order to decide which conversion template to use. It therefore does not require the caller to specify a managed conversion template or conversion layout.

Parameters

  • dDocName: The dDocName of native document to convert.

  • dcPageNum: The page number of the document to convert (optional).

Returns

An HTML string snippet of the document conversion.

Code Example

<!--$ssIncDynamicConversionByRulesEngine("dDocName", "1")-->

9.20 ssIncInlineDynamicConversion

This script extension, like the ssIncDynamicConversion extension, can be used to perform a dynamic conversion of a native document where the resulting HTML is returned in an Idoc string variable that can be placed directly on a web page, in the form of an HTML snippet. Unlike ssIncDynamicConversion, this extension uses a built-in blank template for the dynamic conversion and therefore does not require the caller to specify a managed conversion template or conversion layout.

Parameters

  • dDocName: The dDocName of native document to convert.

  • dcPageNum: the page number of the document to convert (optional).

Returns

An HTML string snippet of the document conversion.

Code Example

<!--$ssIncInlineDynamicConversion("dDocName", "1")-->

9.21 ssIsNativeDoc

Description

This script extension can be used to detect whether a managed document is to be considered a native document, and thus available for dynamic conversion, or a contributor data file, which requires no conversion.

The comparison is not an inclusive test for a native document; the test is an exclusive test for data files. The return of yes as a result means that the document was shown to not be a data file.

Parameters

  • dDocName: The dDocName of document to test.

Returns

Boolean value [1 | 0].

Code Example

<!--$Variable = ssIsNativeDoc("dDocName")-->

9.22 ssRandom

Description

This script extension is used to generate a random number.

Parameters

It has no parameters.

Returns

A non-negative integer value random number.

Code Example

<!--$ssRandom()-->
<!--$Variable = ssRandom()-->

9.23 ssGetNodeProperty

Description

This script extension can be used to obtain a node property for either the current section or an explicitly specified section. It is typically used to access custom node properties.

Parameters

  • nodeId: The nodeId of the section to be queried (optional). If omitted, the current section is used.

  • name: The property name.

Returns

Returns the value of the specified property. If "label" is used, the section label will be returned, but other properties can be specified.

Code Example

For example, the following command will retrieve the section label for the current section:

<!--$ssGetNodeProperty('label')-->

While the following command will retrieve the section label for section 474:

<!--$ssGetNodeProperty('474', 'label') -->

9.24 ssGetWebsiteNodeType

Description

This script extension can be used to tell the difference between a site node (the root of the hierarchy) and a regular section node. It can also tell the difference between an ASP and a non-ASP site or section node.

Parameters

  • siteId: The siteId of the web site to be queried (optional).

  • nodeId: The nodeId of the section to be queried.

Returns

The return value is one of the following:

  • 0: Site node for an HCSP/JSP type site.

  • 2: Section node for an HCSP/JSP type site.

  • 100: Site node for an ASP type site.

  • 102: Section node for an ASP type site.

Code Example

<!--$ssGetWebsiteNodeType("siteId", "nodeId")-->
<!--$Variable = ssGetWebsiteNodeType("nodeId")-->

9.25 ssGetCoreMajorVersion

Description

This script extension can be used to obtain the major version of the underlying content server.

Parameters

It has no parameters.

Returns

Oracle Content Server major version number.

Code Example

<!--$Variable = ssGetCoreMajorVersion()-->

9.26 ssSplitString

Description

This script extension can be used to split a string into segments based on a specified delimiter.

Parameters

  • string: The string to be split.

  • delimiter: The delimiter used to split the string (for example ",").

  • name: The name of the result set to store the results of the split operation.

Returns

The return value is an integer indicating the number of segments that were split out of the supplied string. The extension also generates a ResultSet with one column, named String, listing the split strings.

Code Example

<!--$ssSplitString("ABC;123;XYZ" , ";" , "StorageRows")-->

9.27 ssGetWebsiteName

Description

This script extension can be used to obtain the web site name for any web site on the content server.

Parameters

The parameters are:

  • siteId: The unique identifier for the web site.

Returns

The web site name (label) of the siteId.

Code Example

<!--$ssGetWebsiteName("siteId")-->

9.28 ssGetSiteProperty

Description

This script extension can be used to obtain a site property for any web site on the content server.

Parameters

  • siteId: The unique identifier for the web site.

  • propertyName: The name of the property whose value is required.

Returns

The property listed in propertyName, as a string.

Code Example

<!--$ssGetSiteProperty("siteId" , "propertyName")-->

9.29 ssGetFirstNodeId

Description

This script extension can be used to obtain the identifier (nodeId) for the root node of any web site on the content server.

Parameters

  • siteId: The unique identifier for the web site.

Returns

The Id of the first node.

Code Example

<!--$Variable = ssGetFirstNodeId("siteId")-->

9.30 ssGetRelativeNodeId

Description

This script extension can be used to obtain the identifier (nodeId) of a node relative to a given node.

Parameters

  • siteId: The unique identifier for the web site.

  • nodeId: The unique identifier for the context node.

  • relative: The relationship; must be one of: child, parent, prior, or next.

  • respectContribOnly: A boolean value; the default is yes (optional).

Returns

The nodeId of the node that has the stated relationship to the context node, or an empty string if there is no node with that stated relationship.

Code Example

<!--$Variable = ssGetRelativeNodeId("siteId" , "nodeId" , "child" , "no")-->

9.31 ssLoadSiteNavResultSet

Description

This script extension can be used to create a "SiteStudioNavNodes" ResultSet in the Idoc execution environment that will contain the active hierarchy for any web site on the content server.

Parameters

  • siteId: the unique identifier for the web site

Returns

A ResultSet of the web site hierarchy, called "SiteStudioNavNodes."

The "SiteStudioNavNodes" ResultSet has 5 or more columns, depending on the settings of the configuration flag SSAdditionalNavResultSetFields (For more information, see Section 12.14, "SSAdditionalNavResultSetFields"):

  • nodeId: the unique identifier for the node.

  • parentNodeId: the unique identifier for the parent node.

  • label: the label for the node.

  • level: the depth of the node in the site hierarchy. The root section has a level of 0.

  • href: the site relative path-based URL to the nodes primary page.

Code Example

<!--$ssLoadSiteNavResultSet("siteId")-->

9.32 ssGetServerRelativeUrl

Description

This script extension can be used to generate a server relative URL to the primary layout for a specified node, including the trailing urlPageName (usually index.htm).

Parameters

  • siteId: The unique identifier for the web site.

  • nodeId: A unique identifier for a node.

Returns

A full friendly URL relative to the server.

Code Example

<!--$ssGetServerRelativeUrl("siteId" , "nodeId")-->

9.33 ssGetServerRelativePath

Description

This script extension can be used to generate a server relative URL to the primary layout for a specified node, excluding the trailing urlPageName (usually index.htm).

Parameters

  • siteId: The unique identifier for the web site.

  • nodeId: A unique identifier for a node.

Returns

A full friendly URL relative to the server, not including the page name.

Code Example

<!--$ssGetServerRelativePath("siteId" , "nodeId")-->

9.34 ssGetUrlPageName

This script extension can be used to obtain the urlPageName for a specified node.

Parameters

  • siteId: The unique identifier for the web site.

  • nodeId: A unique identifier for a node.

Returns

The urlPageName of the node. Usually this is index.htm.

Code Example

<!--$ssGetUrlPageName("siteId")-->

9.35 ssGetNodeLabel

Description

This script extension can be used to obtain the label for a specified node.

Parameters

  • siteId: The unique identifier for the web site.

  • nodeId: A unique identifier for a node.

Returns

The label of the specified node.

Code Example

<!--$ssGetNodeLabel("siteId" , "nodeId")-->

9.36 ssGetNodeLabelPath

Description

This script extension can be used to obtain a "/" separated string relative to the root of the web site that can be used for a GUI label (for example, "/products/servers/web server").

Parameters

  • siteId: The unique identifier for the web site.

  • nodeId: A unique identifier for a node.

Returns

The script returns a string separated by "/" of the folders in the stated node in the stated web site.

Code Example

<!--$ssGetNodeLabelPath("siteId" , "nodeId")-->

9.37 ssGetAllSites

Description

This script extension can be used to generate a ResultSet containing a list of all available web sites.

Parameters

  • resultSetName: the name for the generated ResultSet.

Returns

The list of all available web sites on the server is returned in a ResultSet.

Code Example

<!--$ssGetServerRelativePath("resultSetName")-->

9.38 ssLink

Description

This script extension is used to generate a path-based URL to a named document. This is deprecated in preference of wcmUrl (see Section 9.13, "wcmUrl").

For more information, see Section 4.3, "Using Server-Side Script Links."

Parameters

  • dDocName: the dDocName of the managed item.

  • targetNodeId: a unique identifier for a node to use as the target context (optional).

  • targetSiteId: the unique identifier for the web site to use as the target context (optional).

Returns

A string which is the friendly link to a specific piece of content.

Code Example

<!--$ssLink("dDocName" , "targetSiteId")-->
<!--$ssLink("dDocName")-->
<!--$ssLink("dDocName" , "targetNodeId" , "targetSiteId")-->

9.39 ssNodeLink

Description

This script extension is used to generate a path-based URL to a specified node. This is deprecated in preference of wcmUrl (see Section 9.13, "wcmUrl").

For more information, see Section 4.3, "Using Server-Side Script Links."

Parameters

  • nodeId: A unique identifier for a node.

  • siteId: A unique identifier for the web site containing the node (optional).

Returns

The friendly link to the primary (or landing) page of a node.

Code Example

<!--$ssNodeLink("nodeId" , "siteId")-->
<!--$ssNodeLink("nodeId")-->

9.40 ssWeblayoutUrl

Description

This script extension is used to determine the full web address of a file from either the path or dDocName. This is most typically used for paths to images in data files. This is deprecated in preference of wcmUrl (see Section 9.13, "wcmUrl").

For more information, see Section 4.3, "Using Server-Side Script Links."

Parameters

  • targetId: Either the path to a file or the dDocName value of the file.

Returns

A path-based weblayout URL.

Code Example

<!--$ssWeblayoutUrl('mydocname')-->
<!--$ssWeblayoutUrl('groups/public/documents/adacct/mydocname.jpg')-->