I had a need for a plugin like this while working on a few client websites. I finally whipped this together today. Hopefully somebody else finds it useful.
Imagine this scenario: You have built an ExpressionEngine website for a client. Everything works great, but there’s a problem: the client needs to be able to change little pieces of relatively static text. You don’t want to let him into the templates because, well, he’ll screw them up. You don’t want to let him access global template variables for the same reason, and besides, those variables don’t have any formatting options. How can you allow the client to change data—such as the company’s address, or maybe even that “Welcome to our website” text on the homepage—quickly and easily?
GeeVar allows you to create global variables using the control panel’s publish and edit interface. In short, each variable is a weblog entry. That means you can have as many or as few as you need, and you can format each variable’s value however you like (e.g. “none”, XHTML, or even using something like Textile or a wysiwyg editor). The variables are retrieved without the extra processing weight of the Weblog Module. As a bonus, GeeVar’s variables are cached, so the plugin only accesses the database once per page load. Thus, you can use as many GeeVar tag pairs as you like, anywhere in your templates (or embedded templates) without fear of ramping up your query count. In addition, you can nest GeeVar variables, giving you the ability to store a company’s address in a variable like so
{geevar_company_name}
{geevar_company_street_address}
{geevar_company_citystatezip}
{geevar_telephone}
{geevar_fax}
{geevar_email}
and have it turn into
Wally's Widget World
1 Widget Way
Walla Walla, WA 11111
(555) 123-0987
(555) 123-0988
[email protected]
Sound like something you could use? Go try it out.
Mr Wilson, would the plugin still work if I add an extra field in the field group for a description of the variable? This would just be information for the client when they are updating their varibales, ie to explain where the variable appears, or what sections of the site it affects.
Yep, you can add anything extra you want. GeeVar just needs:
It will also look at the custom field’s formatting.
GeeVar will ignore anything else. Field descriptions won’t hurt a thing. You could even add more custom fields if, for example, you wanted to access the data using exp:weblog:entries.
Hi, this does look really useful but we’re struggling to get it working. We’ve followed the instructions in the docs but we can’t get anything to output. It’s simply blank where the variable value should print.
If we turn PHP errors on we do get this error
Notice: Undefined variable: tagdata in /var/www/html/manage/plugins/pi.geevar.php on line 88
The server is running PHP5
Is there any way to implement Geevar with stand alone entry form so that I can make an edit form outside of the control panel? Any links with pointers? 😛
Thanks in advance.
P/S : Was trying out Geevar with the following code : <pre><code> {exp:geevar weblog="wrs_globalvars" var_prefix="var_"}
{var_logged_in_welcome_message}
{/exp:geevar}[/code]
With the following settings :
Weblog Full Name: WRS Global Variables Weblog Short Name: wrs_globalvars URL Title Prefix: var_
Field Order: 1 Field Label: Data Field Name: var_ Field Type: WYSIWYG
But still, the outputs shows “{var_logged_in_welcome_message}” in the browser. Any ideas?
I’ll start with your P.S. … Check the URL title of that entry. It should be “var_logged_in_welcome_message”. Is it? If not, there’s your problem.
As for getting Geevar to work with a stand-alone entry/edit form, it should work just like any other entry/edit form. Let me know if you run into any specific roadblocks.
Mr. Wilson:
I can’t get any output from the GeeVar plugin.
Here’s what I’ve got:
weblog: global 1 custom field: global_address 1 entry with url prefix: global_lvca_address Formatting: textile. I’m also using the TEH extension, if that makes a difference.
template:
{exp:geevar weblog="global"} {global_lvca_address} {/exp:geevar}
Output: {global_lvca_address}
Yes, the plugin is installed. What am I doing wrong?
Also tried it like this:
{exp:geevar weblog="global" var_prefix="global_" } {global_lvca_address} {/exp:geevar}
but still, no output.
GeeVar 1.0.4 has been posted. It now supports “meta” variables, such as status.
@jejuna: Can you download 1.0.4 and see if it fixes your problem? If not, do let me know. I haven’t tested with Textile and I’m not sure what the TEH extension is, so either of those could be the culprits.
I did download and install the new version, but still, no output.
It doesn’t seem to matter whether the text in the custom field is formatted as Textile, XHTML, or “none”, as I’m still getting no output.
I think I’ve done everything correctly:
In the template:
{exp:geevar weblog="global" var_prefix="global_"} {global_lvca_address} {/exp:geevar}
Output: {global_lvca_address}
Note: If I call it from the standard weblog:entries tag, like so:
{exp:weblog:entries weblog="global" entry_id="2"} {global_address} {/exp:weblog:entries}
It outputs fine, but defeats the purpose of the plugin!
Am I missing something? Any ideas are appreciated!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.