<p>You can by using this: <code>{{ include(template_from_string(entry.fieldName)|raw) }}</code> </p>

<p>You could also try it with just <code>|raw</code> But that probably only works for just HTML</p>

<p>This works on both a Plain Textfield aswell on a Richtext area. Although I wouldn't recommend putting code in your textfield's like that.</p>

<p>The original answer on a simular question can be found here: <a href="https://craftcms.stackexchange.com/a/1270/3848">https://craftcms.stackexchange.com/a/1270/3848</a></p>

CC BY-SA 3.0
2017-01-02T15:20:18.473Z
2017-01-02T15:20:18.473Z
2017-04-13T12:51:00.160Z
Justin Dekkers
<p>I want to write an entire loop into a field like this:</p>

<p><a href="https://i.sstatic.net/SUZAY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/SUZAY.png" alt="enter image description here"></a></p>

<p>Obviously this is not working. What would be the correct syntax when twig is written inside a field?</p>

<p>Also is there a name for the twig tags inside a field? I have a hard time searching the interwebz for this.</p>

CC BY-SA 3.0
2017-01-02T15:21:55.620Z
For Twig filters as they are what I think you mean checkout: http://twig.sensiolabs.org/doc/filters/index.html 
Most PHP functions / Filters are supported by twig so might take a look there aswell.
Justin Dekkers
<templating><matrix><forloop>
loop trough whole array inside a field
# loop trough whole array inside a field

(Asked by: username_0 on 2017-01-02)

I want to write an entire loop into a field like this:

[![enter image description here](https://i.sstatic.net/SUZAY.png)](https://i.sstatic.net/SUZAY.png)

Obviously this is not working. What would be the correct syntax when twig is written inside a field?

Also is there a name for the twig tags inside a field? I have a hard time searching the interwebz for this.

**Tags:** templating, matrix, forloop

> **Comments:**
> **username_1**: For Twig filters as they are what I think you mean checkout: http://twig.sensiolabs.org/doc/filters/index.html  Most PHP functions / Filters are supported by twig so might take a look there aswell.  

---

## 1 answers

### Answer by username_1 on 2017-01-02. Score: 2 | Accepted answer

You can by using this: `{{ include(template_from_string(entry.fieldName)|raw) }}`

You could also try it with just `|raw` But that probably only works for just HTML

This works on both a Plain Textfield aswell on a Richtext area. Although I wouldn't recommend putting code in your textfield's like that.

The original answer on a simular question can be found here: <https://craftcms.stackexchange.com/a/1270/3848>


---

