Skip to content

Commit b7f37b3

Browse files
committed
Merge remote-tracking branch 'origin/patch-30' into Pro-Variables-doc-cleanup
2 parents 661b01b + 4fe2558 commit b7f37b3

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

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

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ Character to separate multiple values. Either a new line (`\n`), a pipe (`|`) or
4242

4343
Displays a date picker. To output anything other than a timestamp, use the `{exp:pro_variables:single}` tag. This takes the same parameters as the native Date field. Additionally, use `modifier="relative"` to output a relative date string.
4444

45-
### Code examples
45+
### Code example
4646

47-
{exp:pro_variables:single var="my_var" format="%Y-%m-%d"}
47+
{exp:pro_variables:single var="my_date_var" format="%Y-%m-%d"}
4848

49-
{exp:pro_variables:single var="my_var" modifier="relative"}
49+
{exp:pro_variables:single var="my_date_var" modifier="relative"}
5050

5151
## File
5252

@@ -58,6 +58,16 @@ Uses the native [File field](/fieldtypes/file.md). To output the variable, alway
5858

5959
Allows applying modifiers, which, among other, are used to apply [on-the-fly image manipulations](/fieldtypes/file.md#on-the-fly-image-manipulations) to files
6060

61+
### Code example
62+
63+
{exp:pro_variables:pair var="my_file_var"}
64+
<figure>
65+
<img src="{my_file_var:image}">
66+
<figcaption>Photo by {my_file_var:credit}</figcaption>
67+
</figure>
68+
{my_file_var:description}
69+
{/exp:pro_variables:pair}
70+
6171
## Grid
6272

6373
Uses the native [Grid field](/fieldtypes/grid.md). All native types are available, _except for Relationships and Members_. To output the variable, use the `{exp:pro_variables:pair}` or `{exp:pro_variables:single}` tag where appropriate. You can use any of Grid’s [parameters](/fieldtypes/grid.md#parameters) and [variables](/fieldtypes/grid.md#variables) using these tags. Additionally, one more parameter is available:
@@ -68,17 +78,9 @@ Uses the native [Grid field](/fieldtypes/grid.md). All native types are availabl
6878

6979
Any of the available [modifiers](/fieldtypes/grid.md#modifiers), which will trigger the output the modifier provides.
7080

71-
### Code examples
72-
73-
{exp:pro_variables:pair var="my_var"}
74-
<figure>
75-
<img src="{my_var:image}">
76-
<figcaption>Photo by {my_var:credit}</figcaption>
77-
</figure>
78-
{my_var:description}
79-
{/exp:pro_variables:pair}
81+
### Code example
8082

81-
{exp:pro_variables:single var="my_var" modifier="total_rows"}
83+
{exp:pro_variables:single var="my_grid_var" modifier="total_rows"}
8284

8385
## Radio Group
8486

@@ -257,10 +259,10 @@ The short name of the Image Manipulation you want to output. Alternatively, you
257259

258260
### Code examples
259261

260-
{exp:pro_variables:single var="lv_files_var" manipulation="squared"}
262+
{exp:pro_variables:single var="my_files_var" manipulation="squared"}
261263

262-
{exp:pro_variables:pair var="lv_files_var"}
263-
<img src="{lv_files_var:squared}" alt="">
264+
{exp:pro_variables:pair var="my_files_var"}
265+
<img src="{my_files_var:squared}" alt="">
264266
{/exp:pro_variables:pair}
265267

266268
## Table
@@ -292,13 +294,13 @@ Limit the number of rows displayed.
292294

293295
### Code examples
294296

295-
{exp:pro_variables:pair var="lv_table_var"}
297+
{exp:pro_variables:pair var="my_table_var"}
296298
{if count == 1}<ul>{/if}
297299
<li><a href="{cell_1}">{cell_2}</a></li>
298300
{if count == total_results}</ul>{/if}
299301
{/exp:pro_variables:pair}
300302

301-
{exp:pro_variables:pair var="lv_table_var" sort="random" limit="1"}
303+
{exp:pro_variables:pair var="my_table_var" sort="random" limit="1"}
302304
Random link: <a href="{cell_1}">{cell_2}</a>
303305
{/exp:pro_variables:pair}
304306

@@ -355,14 +357,15 @@ To be used in combination with `format`. Possible values: `none`, `safe` or `all
355357

356358
#### `preparse:_my_var_`
357359

358-
If the variable content contains variables that need to be parsed before it is put in the template, you can use this parameter, similar to [embed variables](/templates/embedding.md#embedding-variables). For example: setting the parameter `preparse:foo="bar"` will replace the variable `{preparse:foo}` with `bar` in the variable content.
360+
If the variable content itself contains variables that ought to be parsed before the Pro Variable is put in the template, you can use this parameter. It's similar to [embed variables](/templates/embedding.md#embedding-variables). For example: setting the parameter `preparse:foo="bar"` will replace `{preparse:foo}` with `bar` in the variable content.
359361

360362
#### `preparse_prefix`
361363

362-
See above, change the default variable prefix from `preparse` to something else. For example, the parameters `preparse:foo="bar" preparse_prefix="lv"` will replace the variable `{lv:foo}` with `bar` inside the variable content.
364+
Used with pre-parsing, this changes the default variable prefix from `preparse` to something else. For example, the parameters `preparse_prefix="pv" preparse:foo="bar"` will replace `{pv:foo}` with `bar` inside the variable content.
363365

364366
### Code examples
365367

366368
{exp:pro_variables:single var="my_var" formatting="xhtml" html="all"}
367369

368-
{exp:pro_variables:single var="my_var" preparse:entry_id="12"}
370+
{!-- for a variable that has {pv:entry_id} and {pv:cat_id} in its content --}
371+
{exp:pro_variables:single var="my_var" preparse:entry_id="12" preparse:cat_id="9" preparse_prefix="pv"}

0 commit comments

Comments
 (0)