Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-27T11:47:52.267Z
Answers.LastActivityDate: 2017-11-27T11:47:52.267Z
Answers.UserDisplayName: laurent
Body: <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>
  
Tags: <templating>
Title: nesting variables in twig
ThreadText: # 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](https://craftcms.stackexchange.com/questions/703/calling-variables-dynamically?rq=1)
  
  Here is the solution :
  
  ```
  {{ _context[ globalHandle ].aFieldHandle }}
  
  ```
  
  
  ---
  
  