const mixinafEfan::EfanTemplate

afEfan::EfanTemplate

A compiled efan template, ready for rendering!

render

Source

virtual Str render(Obj? ctx, |Obj?? bodyFunc := null)

The main render method.

The bodyFunc is executed when renderBody() is called. Use it when enclosing content in Layout templates. Example:

...
<%= ctx.layout.render(ctx.layoutCtx) { %>
  ... my body content ...
<% } %>
...

ctx must be provided. This prevents you from accidently passing in bodyFunc as the ctx. Example:

layout.render() { ... }      // --> WRONG!
layout.render(null) { ... }  // --> CORRECT!

The signature for bodyFunc is actually |->|? bodyFunc - see source for an explanation of why |Obj?|? is used.

renderBody

Source

virtual Str renderBody()

Renders the body of the enclosing efan template. Example, a simple layout.html may be defined as:

<html>
<head>
  <title><%= ctx.pageTitle %>
</html>
<body>
    <%= renderBody() %>
</html>
templateMeta

Source

abstract EfanTemplateMeta templateMeta

Meta data about this efan template.