include_child(name, collection, dataKey)

Loads a template’s child 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 be unique in name. Works only in Template nodes.

Together with render()and include(), include_child() 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.


${include_child('Child Node')}

will render the contents of the child node with the name “Child Node” into the output buffer.

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

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



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