Skip to content

Commit 507b742

Browse files
authored
Update tags.md
Adding examples, reformatting, a few tweaks and changes.
1 parent 14af1f7 commit 507b742

File tree

1 file changed

+36
-21
lines changed

1 file changed

+36
-21
lines changed

docs/add-ons/pro-variables/tags.md

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ In most cases, the simple global variable syntax, eg. `{my_var}` will do. Global
1717

1818
{exp:pro_variables:parse var="my_var"}
1919

20-
Use the Parse, Single or Pair tag to parse variables during the Module & Plugin stage. You can also use parameters, which will allow for more options than just using the variable syntax. Some variable types, like RTE and Grid, require using the tag syntax to trigger additional processing.
20+
Use the Parse, Single or Pair tags to parse variables during the Module & Plugin stage of template parsing. Parse can be used as either a single or a pair tag - but that can sometimes confuse the EE parser if it's in use both ways in a template. Like all `exp:` tags, these can be assigned parameters, which will allow for more options than just using the variable syntax. Some variable types, like File, RTE and Grid, require using the tag syntax to trigger additional processing.
2121

2222
TIP: TIP: **{ee:u}** Learn more about the parsing stages at [ExpressionEngine University](https://u.expressionengine.com/course/ee-conf-spring-summit-2021/eeconf-spring-2021-but-first-parse-order-and-php-in-expressionengines-templates).
2323

@@ -27,7 +27,7 @@ NOTE: **Note:** Whenever you need parameters or additional processing, use the *
2727

2828
#### `var`
2929

30-
Name of the variable you want to parse. Use a colon to separate site name and variable name if you want to parse a variable belonging to a specific site, eg. `my_site:my_var`. If this parameter is omitted, all Pro Variables inside the tag pair are simply replaced with their values.
30+
Name of the variable you want to parse. If you're using multi-site manager, use a colon to separate site name and variable name if you want to parse a variable belonging to a specific site, e.g. `my_site:my_var`. If the var parameter is omitted (it is optional with a tag pair), all Pro Variables inside the tag pair are replaced with their values.
3131

3232
#### `multiple`
3333

@@ -37,38 +37,47 @@ If set to `yes`, the tag will loop through the different values of the variable.
3737

3838
Use in combination with `multiple="yes"` to limit the number of results displayed.
3939

40-
4140
#### _3rd party_
4241

4342
If you’re displaying a 3rd party field type, you can use all parameters you would normally use for the field channel variable pair.
4443

45-
### Variables
44+
### Variable Options
45+
46+
NOTE: **Note:** Some of these `{my_var:…}` variable options are available _only_ when using the Parse tag pair or Pair tag pair, _and_ if the variable type allows multiple items to be selected. For more options on the native variable types, [check their properties](/add-ons/pro-variables/type.md).
4647

47-
#### `{_my_var_:data}`
48+
#### `{my_var:data}`
4849

4950
The variable value.
5051

51-
#### `{_my_var_:data_label}`
52+
#### `{my_var:data_label}`
5253

5354
The variable value’s label, when displaying a Checkbox Group, Radio Group or Select variable type.
5455

55-
#### `{_my_var_:label}`
56+
#### `{my_var:label}`
5657

5758
The variable label, as displayed in the Control Panel.
5859

59-
#### `{_my_var_:count}`
60+
#### `{my_var:count}`
6061

6162
Current count of the loop.
6263

63-
#### `{_my_var_:total_results}`
64+
#### `{my_var:total_results}`
6465

6566
Total of iterations of the loop.
6667

6768
#### _3rd party_
6869

6970
If you’re displaying a 3rd party field type, you can use all variables you would normally use inside the field channel variable pair.
7071

71-
NOTE: **Note:** the `{_my_var_:…}` variables are _only_ available when using the Parse tag pair or Pair tag pair, _and_ if the variable type allows multiple items to be selected. For more options on the native variable types, [check their properties](/add-ons/pro-variables/type.md).
72+
### Variable Modifiers
73+
74+
You can use [variable modifiers](templates/variable-modifiers.md) on Pro Variables when using them in a tag pair.
75+
76+
{exp:pro_variables:parse}
77+
Encrypted text var: {my_text:encrypt}
78+
{/exp:pro_variables:parse}
79+
80+
### Code Examples
7281

7382
{exp:pro_variables:parse var="my_site:my_var"}
7483

@@ -97,15 +106,15 @@ In order to avoid conflicts with multiple instances of the Parse tag, both singl
97106

98107
## Pair tag
99108

100-
{exp:pro_variables:pair var="my_var"}{/exp:pro_variables:pair}
109+
{exp:pro_variables:pair var="my_var"}{my_var:data}{/exp:pro_variables:pair}
101110

102111
In order to avoid conflicts with multiple instances of the Parse tag, both single and paired, you can use the alias `{exp:pro_variables:pair}` for tag pair use. It is identical to the Parse tag, but meant for tag pair use only.
103112

104-
You can also use [variable modifiers](templates/variable-modifiers.md) on pro variables when using them in a tag pair:
113+
You can also use [variable modifiers](templates/variable-modifiers.md) on Pro Variables when using them in a tag pair:
105114

106-
{exp:pro_variables:parse}
115+
{exp:pro_variables:pair var="my_text"}
107116
Encrypted text var: {my_text:encrypt}
108-
{/exp:pro_variables:parse}
117+
{/exp:pro_variables:pair}
109118

110119
## Label tag
111120

@@ -117,29 +126,33 @@ You can display the label of any variable by using this tag. Use as single tag o
117126

118127
#### `var`
119128

120-
Name of the variable you want to fetch the label from. Use a colon to separate site name and variable name if you want to parse a variable belonging to a specific site, eg. `my_site:my_var`. _This is a required parameter_.
129+
Name of the variable you want to fetch the label from. Use a colon to separate site name and variable name if you want to parse a variable belonging to a specific site, e.g. `my_site:my_var`. _This is a required parameter_.
121130

122131
## Options tag
123132

133+
{exp:pro_variables:options var="my_site:my_multi_var"}
134+
<label><input type="checkbox" value="{my_multi_var:data}" {checked} /> {my_multi_var:data_label}</label>
135+
{/exp:pro_variables:options}
136+
124137
This tag pair allows you to display the options for a given variable. Use this in combination with the **Checkbox Group**, **Radio Group** and **Select** variable types.
125138

126139
### Parameters
127140

128141
#### `var`
129142

130-
Name of the variable you want to parse. Use a colon to separate site name and variable name if you want to parse a variable belonging to a specific site, eg. `my_site:my_var`. _This is a required parameter_.
143+
Name of the variable you want to parse e.g. `var="my_var"` . Use a colon to separate site name and variable name if you want to parse a variable belonging to a specific site, eg. `my_site:my_var`. _This is a required parameter_.
131144

132-
### Variables
145+
### Variables and Variable Options
133146

134-
#### `{_my_var_:data}`
147+
#### `{my_var:data}`
135148

136149
Value of the option.
137150

138-
#### `{_my_var_:data_label}`
151+
#### `{my_var:data_label}`
139152

140153
Associated label of the value.
141154

142-
#### `{_my_var_:label}`
155+
#### `{my_var:label}`
143156

144157
Label of the variable itself.
145158

@@ -161,7 +174,9 @@ The total amount of options.
161174

162175
#### `{count}`
163176

164-
The count out of the current option.
177+
The count of the current option.
178+
179+
### Code Examples
165180

166181
{exp:pro_variables:options var="my_multi_var"}
167182
{if count == 1}<ul>{/if}

0 commit comments

Comments
 (0)