# `template_from_string`
New in version 1.11: The `template_from_string` function was added in Twig 1.11.
The `template_from_string` function loads a template from a string:
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2</pre></div></td><td class="code"><div class="highlight"><pre>{{ include(template_from_string("Hello {{ name }}")) }}
{{ include(template_from_string(page.template)) }}
</pre></div></td></tr></table>
Note
The `template_from_string` function is not available by default. Youmust add the `Twig_Extension_StringLoader` extension explicitly whencreating your Twig environment:
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2</pre></div></td><td class="code"><div class="highlight"><pre>$twig = new Twig_Environment(...);
$twig->addExtension(new Twig_Extension_StringLoader());
</pre></div></td></tr></table>
Note
Even if you will probably always use the `template_from_string` functionwith the `include` function, you can use it with any tag or function thattakes a template as an argument (like the `embed` or `extends` tags).
### Arguments
- `template`: The template
- Twig
- Introduction
- Installation
- Twig for Template Designers
- Twig for Developers
- Extending Twig
- Twig Internals
- Deprecated Features
- Recipes
- Coding Standards
- Tags
- autoescape
- block
- do
- embed
- extends
- filter
- flush
- for
- from
- if
- import
- include
- macro
- sandbox
- set
- spaceless
- use
- verbatim
- Filters
- abs
- batch
- capitalize
- convert_encoding
- date
- date_modify
- default
- escape
- first
- format
- join
- json_encode
- keys
- last
- length
- lower
- merge
- nl2br
- number_format
- raw
- replace
- reverse
- round
- slice
- sort
- split
- striptags
- title
- trim
- upper
- url_encode
- Functions
- attribute
- block
- constant
- cycle
- date
- dump
- include
- max
- min
- parent
- random
- range
- source
- template_from_string
- Tests
- constant
- defined
- divisible by
- empty
- even
- iterable
- null
- odd
- same as