Low Variable Fieldtypes
Low Variables 2.0.0 introduces the Low Variables Fieldtype. You can now choose to add a list of variables to your publish page, outputting the variable name. You can use that in other tags, like the {exp:low_variables:parse} tags. Per Low Variables field, the following settings apply:
Settings
Allow multiple
Variable groups
Please note that only non-hidden and variables with early parsing disabled show up in the variable list in the Publish Form.
The value of the field will be the variable name, for example: my_var. To output the variable name as a variable itself, add the suffix :var to your channel field name, for example: {my_channel_field:var}. This will output {my_var}, which will be parsed by the ExpressionEngine template parser at a later stage.
Examples
Say you have 5 different testimonial quotes stored as variables in the variable group Quotes, named lv_quote_1 to lv_quote_5. To each News entry, you want to add one of those quotes. Then add a Low Variables field to your News field group, eg. news_quote. Then select the Quotes group in the field settings. To output the quote, you’d need code like this:
{exp:channel:entries channel="news"}
<h2>{title}</h2>
{news_intro}
{if news_quote}
<blockquote><p>{news_quote:var}</p><
<blockquote>{/if}
{/exp:channel:entries}
You can use additional data by feeding the field value to the Low Variables template tag parameter, for example:
{exp:channel:entries channel="news"}
<h2>{title}
{news_intro}
<div class="meta">
<p>{exp:low_variables:label var="{news_quote}"}:</p>
<blockquote>{exp:low_variables:single var="{news_quote}" format="textile"}
</div>
{/exp:channel:entries}
If you’re allowing for multiple selections, you can use the channel field as a variable pair. In that case, use the variable {var} to output the variable name. For example:
{exp:channel:entries channel="news"}
<h2>{title}
{news_intro}
{news_quotes}
<blockquote><p>{{var}}</p></blockquote>
{/news_quotes}
{/exp:channel:entries}