0

I have a document with ID = 1, which relies on a series of template variables in the format [+template-variable-NUMBER+]. I have filled fields using these values, and it's good for document ID = 1. What I want to do, however, is paste the values of the template variables for ID = 1 into a document with ID = 2.

I want to use: [+template-variable? id='1'+] or something similar in ID = 2

In short, I need to have 3 groups of variables which are the same for both pages and I don't want to have to fill them in twice.

Troy Alford
  • 26,660
  • 10
  • 64
  • 82
Tomasz Szulc
  • 4,217
  • 4
  • 43
  • 79

2 Answers2

2

You can use the getField snippet to achieve this: http://modx.com/extras/package/getfield

[!getField? &docid=`1` &field=`template-variable-name`!]
okyanet
  • 3,106
  • 1
  • 22
  • 16
0

An alternative is the fastField extra http://modx.com/extras/package/fastfield

You can then access the template variables from another resource with the following notation.

[[#1.tv.template-variable-NUMBER]]

Where the #1 is pointing to the resource ID=1, you can get most resource properties directly this way,it just the template variables which require the extra .tv. notation

Adrian
  • 3,246
  • 19
  • 22