<p>OK, my bad, this was answered <a href="https://craftcms.stackexchange.com/questions/703/calling-variables-dynamically?rq=1">here</a></p>

<p>Here is the solution :</p>

<pre><code>{{ _context[ globalHandle ].aFieldHandle }}
</code></pre>

CC BY-SA 3.0
2017-11-27T11:47:52.267Z
2017-11-27T11:47:52.267Z
laurent
<p>I have 3 sets of globals, which use the same fields handles.</p>

<pre><code>{{ firstGlobalHandle.aFieldHandle }}
{{ secondGlobalHandle.aFieldHandle }}
{{ thirdGlobalHandle.aFieldHandle }}
</code></pre>

<p>In a child template, I set a variable corresponding to the handle of the global group which I need to call</p>

<pre><code>{% set globalHandle = "secondGlobalHandle" %}
</code></pre>

<p>Now in the In the parent template, I would like to do the following :</p>

<pre><code>{{ '{{ globalHandle }}'.aFieldHandle }}
</code></pre>

<p>Is there any way to do so ?</p>

<templating>
nesting variables in twig
# nesting variables in twig

(Asked by: username_0 on 2017-11-27)

I have 3 sets of globals, which use the same fields handles.
{{ firstGlobalHandle.aFieldHandle }}
{{ secondGlobalHandle.aFieldHandle }}
{{ thirdGlobalHandle.aFieldHandle }}

In a child template, I set a variable corresponding to the handle of the global group which I need to call
{% set globalHandle = "secondGlobalHandle" %}

Now in the In the parent template, I would like to do the following :
{{ '{{ globalHandle }}'.aFieldHandle }}

Is there any way to do so ?

**Tags:** templating

---

## 1 answers

### Answer by username_0 on 2017-11-27. Score: 2 | Accepted answer

OK, my bad, this was answered here
Here is the solution :
{{ _context[ globalHandle ].aFieldHandle }}


---

