Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

76 lines (58 sloc) 4.449 kb

Show a template.

This controller renders the template configured in the dispatch rules.

Example dispatch rule:

{home, [], controller_template, [{template, "home.tpl"}]}

This will render the home.tpl template at the url /.

Dispatch arguments

controller_template recognizes the following arguments inside the dispatch pattern:

Argument Description Example URL
id A resource id to be used in the template. This can be the numerical id or the unique name of a page. More commonly the id is given as a dispatch option. /page/12345

Dispatch options

The following options can be given to the dispatch rule:

Option Description Example
template Name of the template to be rendered. Can also be a tuple of the following form: {cat, Name}. See also: :ref:`tag-catinclude`. {template, "home.tpl"} {template, {cat, "home. tpl"}}
anonymous Render the template always as the anonymous user, even when an user is logged on. Defaults to false. {anonymous, true}
content_type The content type provided by the dispatch rule. Defaults to “text/html”. {content_type, "application/json"}
maxage The number of seconds of how long to cache this file in the browser. Sets the response header: Cache-control: public; maxage=X. {maxage, 3600}
acl_action What ACL action will be checked. Defaults to 'view'; but can also be 'edit' if users need edit permission on the rsc to be able to access the resource. {acl_action, edit}
acl Extra authorization checks to be performed. See `ACL options`_.
id Id or unique name of a resource to be referenced in the rendered template. This overrules and id from the query arguments. {id, page_about}
Jump to Line
Something went wrong with that request. Please try again.