I need to be able to pass a template variable value from one page to another. For example my main page has a template variable assigned called "phone". This simple holds a telephone number value that is displayed on the page. I then want to be able to use this same value on other pages without having to assign the template variable to the page and retype the value.
I’m sure this is possible and I believe I have to use the @DOCUMENT or something like that, but I’m not really sure what I’m doing.
Can anyone lend some assistance or direct me to the appropriate documentation?
-
MODX Staff
- 10,725 Posts
If the other pages are children of the document you are providing the value for, one solution would be to give the TV a default value of @INHERIT and assign it to the template( s ) of both the parent and the children. Then whatever value the parent document has, the children will inherit, and you will not have to go type the value again.