Can someone give me a real world example of a Global Variable that they use on their website?
I understand the concept. I am just having a hard time thinking about how I can utilize this feature.
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
September 09, 2008 10:00pm
Subscribe [8]#1 / Sep 09, 2008 10:00pm
Can someone give me a real world example of a Global Variable that they use on their website?
I understand the concept. I am just having a hard time thinking about how I can utilize this feature.
#2 / Sep 09, 2008 10:26pm
I’ve used it to give allow small snippets of content that aren’t big enough to be put in their own entry a place to live that allow them to be editable in the control panel. One example of this is text that pops up with you click a help button (just as an example from a site I recently built). The text is just one or two sentences, yet the client needed to be able to edit that text without going into the templates. Global variables came in handy here, even though we only used that variable once.
That’s just one use. I’m sure others have more.
#3 / Sep 10, 2008 1:54am
I am using it all the time. I have used {doctpye}, {image_dir}, {company_address} on the last project, and probably a dozen more.
#4 / Sep 10, 2008 2:01am
good suggestions! I think I can find some new ideas for my websites.
#5 / Sep 11, 2008 4:06am
Don’t forget Fresh Variables, which expands on Global Variables.
#6 / Oct 03, 2008 4:19pm
Would you want to use your navigation in Global variables or is that bad practice and stick to embeds?
#7 / Oct 03, 2008 4:38pm
I’ll second Sue’s Fresh Variables recommendation. For every site I do, I create variables for “Edit entry” buttons, tracking code (Google analytics, Mint, etc.), etc. Basically, anything that isn’t big enough for a weblog entry, but still needs to be easily editable.
I’m working now on a site for an annual event, and I’ve created variables for the event day, date and year, so that I only have to update the 3 variables once a year, and the changes will be reflected everywhere.
#8 / Oct 03, 2008 4:46pm
aircrash, could you just use global variables instead of fresh variables?
Maybe I just don’t under fresh vs. global?
#9 / Oct 03, 2008 8:17pm
Fresh Variables allows you to use php and ee code within the variables, so things like the Edit Entry buttons require Fresh Variables, but the other things I mentioned could just be global variables. I use Fresh Variables for everything just so I can have them all in one place; I make a “Variables” tab in the control panel for quick access to the FV module page.
#10 / Oct 03, 2008 8:32pm
Fresh Variables do not work with IE 6 or 7… unfortunately.
#11 / Oct 03, 2008 9:20pm
Why wouldn’t they work in IE6 or IE7?
#12 / Oct 03, 2008 9:32pm
It needs a DOM-compliant web browser, so no IE.
It says so here: http://expressionengine.com/downloads/details/fresh_variables/
#13 / Oct 03, 2008 9:32pm
I believe the IE problem is the back-end ajax bit, not the variables themselves.
#14 / Oct 04, 2008 12:00am
I believe the IE problem is the back-end ajax bit, not the variables themselves.
What sites do you have live with fresh variables that we can test in ie.
#15 / Oct 04, 2008 12:49am
I can’t say, due to restrictions from my employer, but I’ve used them in at least half a dozen sites that have been heavily tested in IE 6, & 7 (and sometimes 8).