The variables plugin gives the possibility to create variables (either static or dynamic) and use them later on. This means that for example you can set certain data and use it in the head (if it’s embedded) without having to re-create a tag pair for the specific channel.
I wrote the plugin because I didn’t want to use an excessive amount of tags in order to retrieve specific data. For example, each blog entry on my website has a set of meta keywords and a meta description (stored in a custom field). The normal way to retrieve them is the create a new channel tag and fetch the meta data. This wasn’t something I was really looking forward to. First of all it makes the source code a mess and second it makes the system load slower (I’m a speed freak).
The solution? Write a plugin that stores certain data for usage later on. This is what Variables does. On my website I use Variables on pretty much every page in the main channel tag. For instance, on the blog index the code looks a bit like the following:
{exp:channel:entries channel="blog" orderby="date" sort="desc" limit="8" status="open" paginate="bottom" cache="yes" refresh="30" disable=”member_data|trackbacks|”}
{exp:variables:append name='meta_keywords' value='{meta_keywords}'}
{/exp:channel:entreis}As you can see this is much easier than having to create another channel entries tag in the header template.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.