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.

render()

Usage

render(nodes)
render(node)

Description
Renders the HTML representation of the given node(s) into the output buffer. This method is exactly equivalent to the rendering process that Structr uses internally to create the HTML output of pages etc. It can be used to render dynamic content in pages with placeholders etc.

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

Example

${render(children)}

Search results for "render()"

render()

Renders the HTML representation of the given node(s) into the output buffer. This method is exactly equivalent to the rendering process that Structr uses internally to create the HTML output of pages etc. It can be used to render dynamic content in pages with placeholders etc.
Together with include(), render() is one of the the most important method when dealing with HTML web templates, since it allows the user to fill static HTML pages with dynamic content from the underlying node structure. See Page Rendering for more information on this topic.

render(nodes)
render(node)

Template Elements

Therefore, the rendering flow stops at template elements and does not render the remaining branch of the DOM tree. Instead, the template element has to explicitly invoke the rendering process for it’s child elements in the appropriate place. To accomplish this, Structr provides the children keyword and the render() function, as shown in the example below. While this makes the configuration of template elements a bit more subtle than that of content elements, it provides much more flexibility.

Templates

Other than content elements, template elements can have child elements in the DOM tree which makes them very flexible. There are two special template expressions that help organizing the content rendering hierarchy: render() and include_child().