User Guide

Creating Global Variables in ExpressionEngine

eeSiteKit requires the use of a global template variable to set the URL for nearly all of its dynamic path building, and encourages the use of a second global template variable for images used in your site’s design.

Creating a global template variable for your site’s URL allows you to set (and reset) the base path for your whole site in one place.

Many websites are developed on local machines, development servers, or in new hosting accounts with a temporary URL. Some developers will also rename or remove the “index.php” file EE uses during development and/or on launch day, so there’s no way for eeSiteKit to predict your specific URL needs for the site. Setting up a global template variable solves this challenge for the most part. We call this variable:

{global_url}

You’ll need to know the URL of your public directory, where your site is being developed. If you are building or rebuilding a website at working domain, then it’s pretty easy; it will likely be:

http://www.asitedomain.com/index.php/

but if you are developing the new site at a temporary URL, the URL may look more like one of these:

http://asitedomain.pmhclients.com/

http://subdomain.hostingcompany.com/~0001/index.php/

https://www.hostingcompany.net:8443/sitepreview/http/mydomaincom/index.php/

If you are using a temporary URL for site development, we recommend you do not attempt to rename or remove EE’s index.php segment from your URI until after you’re sure eeSiteKit is correctly set up and working on your server, as renaming or removing the index.php segment too soon can make it very difficult to track down other issues you may be having. Also, some hosting servers can’t function without the index.php in the URI until after the site is being served with the domain in the URL. For this reason, we recommend keeping index.php in your URI until launch day.

Trailing Slash: Please note the trailing slash in all the examples above. While it may seem counter-intuitive, eeSiteKit needs a trailing slash “/” at the very end of the “global_url” global template variable. eeSiteKit expects there to be a trailing slash in your global template variables, and many of its dynamic paths will not function as expected without it.

To set up your global_url global template variable (required), navigate to the Template Management area of the control panel (the big Template tab).

  • In the upper row of links look for Global Variables and click it
  • Click on the Create a New Global Variable Button
  • Variable Name: global_url (EE will add the curly braces for you after you hit submit)
  • Variable Content: your development url goes here (remember to use a trailing slash)
  • Click the Submit button

Also, we’ve found it a real time saver to use a global template variable called

{global_image_url}

that we use for design/style related images in the site’s display templates. It allows us to set up image links like this, all of which can be reset in one place on launch day:

<img src="{global_image_url}images/site/some_image.png" />

These become a real time-saver on launch day, as we don’t have to track down any little inline images we’ve forgotten about in the templates.

To set up your global_image_url global template variable (optional), navigate to the Template Management area of the control panel (the big Template tab).

  • In the upper row of links look for Global Variables and click it
  • Click on the Create a New Global Variable Button
  • Variable Name: global_image_url (EE will add the curly braces for you after you hit submit)
  • Variable Content: your development url goes here without index.php in the path (remember to use a trailing slash)
  • Click the Submit button

Your global template variables are all set up for eeSiteKit.

If you are using eeSiteKit within EEs Multiple Site Manager here are a couple of links you might find helpful:
Setting up domains and sub-domains
Setting up global template variables for things like eeSiteKit’s {global_url}

Windows Server: If you are on a Windows server and are having to Force URL Query Strings, you may need to set up your “global_url” with a question-mark included:

http://www.asitedomain.com/index.php?/