Skip to content

Instantly share code, notes, and snippets.

@kentfredric
Created October 20, 2009 12:15
Show Gist options
  • Save kentfredric/214214 to your computer and use it in GitHub Desktop.
Save kentfredric/214214 to your computer and use it in GitHub Desktop.
# Form.tt
<!-- the 'form' wrapper is a hookable printer that by default just stuffs in the form, and where the form is going to -->
[% WRAPPER form %]
<!-- Fields that aren't entirely self-rendering, but parts of the field are -->
<!-- note: the 'field' wrapper can theoretically possibly be a callback that allows either
generic wrapping of form elements, or specific on a name-by-name basis
-->
[% WRAPPER field name=email %]
<span>[% label %]</span><span>[% field %]</span><span>[% description %]</span>
[% END %]
<!-- Fields that are entirely self-rendering -->
[% password %]
[% submit %]
[% END %]
# Theoretical compiled Pseudocode.
$email = '<span>' . $form->email->label->render . '</span><span>' . $form->email->field->render . '</span><span>' . $form->email->description->render . '</span>' ;
$email = wrap('field', name => 'email', content => $email);
$password = $form->password->render;
$submit = $form->submit->render;
$body = $email . $password . $submit;
$body = wrap('form', content => $body );
return $body;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment