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.

Graph-Browser

Related Articles
About this article
Last change 2018-08-24
Topics FrontendFunctionsStructr 2.0