<p>You'd want to do something like this:</p>

<pre><code>{{ "#" ~ craft.config.siteCode ~"Defaults.defaultTelephoneLink" }}
</code></pre>

CC BY-SA 3.0
2017-05-17T09:43:22.003Z
That outputs the string on the screen - not pull it from the database..
mmc501
CC BY-SA 3.0
2017-05-17T19:37:18.997Z
It's assuming you've got a custom `siteCode` config settings set in you `craft/config/general.php` file and it should concatenate the value of that config setting into the anchor.
Brad Bell
CC BY-SA 3.0
2017-05-17T19:39:48.473Z
Just realized you originally referenced a global set.  Any reason why you're going through `craft.config` for that?
Brad Bell
CC BY-SA 3.0
2017-05-17T21:46:49.460Z
I have 2 global sets with fixed info for each site, e.g tel no email, social links. So global sets are site1Defaults and site2Defaults. So I thought I could reference the same variable using the config settings for each site in general.php to change the global set being used. So just using the 1 template file. Can easily change it to include a different template file if need be.
mmc501
CC BY-SA 3.0
2017-05-10T17:48:25.260Z
2017-05-10T17:48:25.260Z
Brad Bell
<p>I have a site which has another group site - both use same templates but I want to include different phone number in the header of each.</p>

<p>I was wanting to use Global Set Variables to pull this information in.</p>

<p>It works fine in the execute delimiters but not in the print delimeters.</p>

<p>This works fine:</p>

<pre><code>{% include "includes/#{ craft.config.siteCode }/head-constants" %}
</code></pre>

<p>Is there any way to include it within another variable like below:</p>

<pre><code>{{ #{ craft.config.siteCode }Defaults.defaultTelephoneLink }}
</code></pre>

<p>This gives the Template Error: Unexpected character "#". </p>

<templating><variable><environmentvariables>
Include Global Set Variable in Print Delimiters
# Include Global Set Variable in Print Delimiters

(Asked by: username_0 on 2017-05-10)

I have a site which has another group site - both use same templates but I want to include different phone number in the header of each.
I was wanting to use Global Set Variables to pull this information in.
It works fine in the execute delimiters but not in the print delimeters.
This works fine:
{% include "includes/#{ craft.config.siteCode }/head-constants" %}

Is there any way to include it within another variable like below:
{{ #{ craft.config.siteCode }Defaults.defaultTelephoneLink }}

This gives the Template Error: Unexpected character "#".

**Tags:** templating, variable, environmentvariables

---

## 1 answers

### Answer by username_1 on 2017-05-10. Score: 1

You'd want to do something like this:
{{ "#" ~ craft.config.siteCode ~"Defaults.defaultTelephoneLink" }}

> **Comments:**
> **username_0**: That outputs the string on the screen - not pull it from the database..  
> **username_1**: It's assuming you've got a custom `siteCode` config settings set in you `craft/config/general.php` file and it should concatenate the value of that config setting into the anchor.  
> **username_1**: Just realized you originally referenced a global set.  Any reason why you're going through `craft.config` for that?  
> **username_0**: I have 2 global sets with fixed info for each site, e.g tel no email, social links. So global sets are site1Defaults and site2Defaults. So I thought I could reference the same variable using the config settings for each site in general.php to change the global set being used. So just using the 1 template file. Can easily change it to include a different template file if need be.  

---

