variablesmodxmodx-evolutionmodx-templatesmodx-chunks

Loading template variables from another document


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.


Solution

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

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