Use Variables in Control Panel Settings

Make the site launch process easier by using either the site_url or homepage variables in configuring Control Panel paths.


I think the site_url and homepage variables are a couple of my favorites in ExpressionEngine. I’ve found that you can actually use these in the EE Control Panel - wherever paths need to be specified.  This includes:

  • Weblog Path Settings
  • File Upload Preferences
  • Category Image URLs

Note that this approach doesn’t seem to work in

  • Member Image (avitar, signature, photo) Preferences

Also - I’ve found that if you want to use the image resizer plugin it will not work with variables in the file upload preferences.

Why would you want to use variables in these spots?

What happens to me quite often is - no matter how hard to I try to remember - I forget to change these paths after a site goes live.  Then when, for example, someone uses the Search, the path of the link returned still has the “temporary” domain name in it.  The link will still work, but it messes up your server logs and just doesn’t look as nice as getting the live URL in there.  Or - I decide to rename “index.php” to something more semantic and then have to go find all the places where “index.php” is stored.

So - what I discovered I could do is use the variables in those settings - and then they will inherit the change to the homepage and root URL setting automatically.

So, for example, rather than having a Search Results URL setting of : 

I can specify:


Now when I change the “URL to the root directory of your site” and the “Name of your site’s index page” under Admin >  System Preferences >  General Configuration all those individual weblog paths will change as well.

With some paths -like category images - you won’t want the “index.php” in there since you are referring to an image and not a template.  In that case you can use site_url instead:


Variables in Control Panel path settings == one less thing to worry about when launching a site == well worth it.

Category Navigation

Next Entry >>


Previous Comments

Picture of Steven Hambleton

by Steven Hambleton

Date: Friday, August 1st, 2008
Comment: #1

I wonder why it’s not in the CP as standard?

Picture of Peccavio

by Peccavio

Date: Tuesday, August 5th, 2008
Comment: #2

I really enjoy almost of {site_url}

{site_url} & {homepage} work well within the template engine but with some plugins while using MultiSite Manager these often give wrong results.

When setting up as secondary site, your great business site tutorial. “Image Sizer” plugin needed the image path defined as…

{site_url} failed to display.

Using TinyMCE plugin with images, {site_url} get’s even stranger. I use…

(btw) the above mentioned tutorial… services/detail template appears broken on your demo site

Thanks again for these tutorials

Mike Boyink

by Mike Boyink (Author)

Date: Tuesday, August 5th, 2008
Comment: #3

Hi Peccavio -

Thanks for the comment and the input.  Good point on the plugins and MSM—that’s a layer of complexity many of the third party developers overlook when creating plugins, IMHO.  Good to be on the lookout for it.

On the broken template - do you mean the demo site here or on  I’m in the process of bringing those tutorials over to train-ee and simplifying the backend required in the process.  If you have a link I’d greatly appreciate it.

Picture of mes

by mes

Date: Friday, August 15th, 2008
Comment: #4

I guess its a good thing I am coming to the training because i can’t seem to figure out how to implement your suggestion above. I put {site_URL} in the control panel under general configuration and it brought down the site :>.

Can you be more explicit or am I just missing the obvious? I think i just dont get how to use the variables in the context syntactically.

Mike Boyink

by Mike Boyink (Author)

Date: Friday, August 15th, 2008
Comment: #5

Ah - that’s where the *value* of the variable needs to be entered. 

In other words the site_url variable will always return what you’ve specified under General Configuration.  Put the URL there, and use site_url in the other places I mentioned.

Add Your Comment

Commenting is not available in this channel entry.

Unless otherwise stated all content is © Michael Boyink of & Boyink Interactive. Please don't steal - I've got kids to feed...