Question

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.

Was it helpful?

Solution

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

[!getField? &docid=`1` &field=`template-variable-name`!]

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top