Rendering Content With Elements

View Templates

At the heart of an Element, is a View Template, written in the Handlebars templating language.   

View Templates are able to render any object inside the current render context. They can do logic, and selectively pass context to sub-elements, often referred to as partials. With sub-elements, a single template can be created for a page header, then included everywhere its needed without duplicating any code.

By default, every Element has access to the objects in the xpr object where xpr.request lives.

A simple View Template might look like this:  

<head>

    <title>{{xpr.request.section.Title}}</tilte>

</head>  

<body>
<h1>Hello World!</h1>
    <h2>The current server date is {{xpr.server.date}}</h2>
    {{#with xpr.request.user}}
        It looks like {{.Username}}} is logged in!
    {{/with}}
</body>