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 "#".

1 Answer 1


You'd want to do something like this:

{{ "#" ~ craft.config.siteCode ~"Defaults.defaultTelephoneLink" }}
  • That outputs the string on the screen - not pull it from the database..
    – mmc501
    Commented May 17, 2017 at 9:43
  • 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
    Commented May 17, 2017 at 19:37
  • Just realized you originally referenced a global set. Any reason why you're going through craft.config for that?
    – Brad Bell
    Commented May 17, 2017 at 19:39
  • 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
    Commented May 17, 2017 at 21:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.