You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

include()

Usage

include(name)
include(name, collection, dataKey)

Description
Loads the element with the given name and renders its HTML representation into the output buffer. Nodes can be included via their name property. When used with an optional collection and data key argument, the included HTML element will be renderd as a Repeater Element.

Possible nodes MUST:
1. be unique in name
2. NOT be in the trash

Possible nodes CAN be
1. somewhere in the pages tree
2. in the Shared Components

Together with render(), include() is one of the most important methods when dealing with HTML web templates since it allows the user to populate static HTML pages with dynamic content from the underlying node structure. See Page Rendering for more information on this topic.

Examples

${include('Main Menu')}

will render the contents of the Shared Component with the name “Main Menu” into the output buffer.

${include('Item Template', find('Item'), 'item')}

will render the contents of the Shared Component with the name “Item Template” repeatedly for every Item node in the database.

Search results for "include()"

include()

Loads the element with the given name and renders its HTML representation into the output buffer. Nodes can be included via their name property. When used with an optional collection and data key argument, the included HTML element will be renderd as a Repeater Element.

Possible nodes MUST:
1. have a unique name
2. NOT be in the trash

Possible nodes CAN:
1. be somewhere in the pages tree
2. be in the Shared Components

Together with render(), include() is one of the most important methods when dealing with HTML web templates since it allows the user to populate static HTML pages with dynamic content from the underlying node structure.

include(name)
include(name, collection, dataKey)

Content Types

This content type must be set on template elements or content elements that are included using the built-in include() function, and on so-called Main Page Templates that use ${render(<a data-id="3230f1d81eb345c199024b82eb7c56f2" class="mention">children</a>)}.

Templates

We can address the first issue by replacing the HTML code of the navigation bar and the footer by expressions that render the respective shared components into the page instead by using the include() system function. This function takes the name of the element as argument a name.