Template Element Element

Getting Started | API | Elements | Actions | Validators | Handlers | Configuration Options | About

Table of Contents

1 Template Element - #template {}

The template element allows you to specify html chrome for your page (header, footer, columns, etc.) while using a special placeholder syntax to call back to your page or any Erlang module.

To specify a placeholder in the html template file, use the form =[Module:Function(Args)]=. Module can be any module, or can be the atom 'page' to refer to the currently Nitrogen page. The function must return either one or more Nitrogen elements, an Erlang string, or an Erlang binary.

If the args are variables such as MyArg1 (as opposed to a static value such as 5), then the template element will look in its bindings property for a matching element.

Usage

#template { files="./priv/templates/myTemplate.html", bindings=[
  {'Binding1', binding1},
  {'Binding2', binding2}
]}

Attributes

file - (String)
Path to an html template file, relative to the directory from which Erlang was started.
bindings - (Bindings, as expected by erl_eval)
A list of variable bindings to be used for arguments specified in the template.

Example value: [{'MyArg1', "Hello"}, {'MyArg2', "World"}]

See Also

Date: 2012-10-18 03:24:34 CDT

Author: Rusty Klophaus (@rustyio)

Org version 7.8.02 with Emacs version 23

Validate XHTML 1.0

Comments

Note:To specify code blocks, just use the generic code block syntax:
<pre><code>your code here</code></pre>


comments powered by Disqus