How to use

Templates may be used as email contents, or the response of custom routes. They're compiled using mustache or handlebars syntax.

Generating a template from commandline:

hook generate:template user_signup
...
Template created at 'hook-ext/templates/user_signup.html'.

Consuming the template:

$string = Module::template('user_signup.html')->compile(array(
  'name' => "Somebody"
));

Helpers

String helpers

Helper Template Output
str_plural {{ str_plural "hook" }} hooks
str_singular {{ str_singular "hooks" }} hook
uppercase {{ uppercase "hook" }} HOOK
lowercase {{ lowercase "HOOK-Platform" }} hook-platform
camel_case {{ camel_case "hook_platform" }} hookPlatform
snake_case {{ snake_case "HookPlatform" }} hook_platform

Miscelaneous

config

Get a definition from hook-ext/config.yaml

{{ config 'site_url' }}

count

Count number of items in array.

{{ count items }}

URL helpers

Generate a HTML link to the given URL.

{{ link_to "about" "About page" class="featured" }}

form

Generate HTML form tag.

{{#form method="post"}}
  {{ input "username" }}
  {{ input "password" type="password" }}
{{/form}}

form_for

Same as form. Plus generated field names will have a namespace. Example: <input name="item[name]" />

{{#form_for "item"}}
  {{ input "name" }}
  {{ input type="submit" value="Create!" }}
{{/form}}