This course will be retired on June 1, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Macros can be defined in any template, and need to be "imported" via the import tag before being used.
Macros can be defined in any template, and need to be "imported" via the import tag before being used:
{% import "forms.twig" as forms %}
<form method="post">
{{ forms.input('name', post.name) }}
{{ forms.input('email', post.email, 'text', "We'll never share your email with anyone else.") }}
{{ forms.textarea('message') }}
<button type="submit" class="btn btn-primary">Send Message</button>
</form>
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up