Quote from: modxusr at Sep 28, 2006, 03:48 AM
Hi,
I have a (news)folder containing some douments(news items). I have a TV defined.
How do I get the value of that TV in (another) document where news is listed.
I tried [+varname+] in the chunk (news template) but it returned a blank value. 
I looked at many posts but am slightly confused whether to use @inherit, binding or getTemplateVar() etc ...
Greatly appreciate the help you guys are providing..
Thanks in advance.
Hello,
If I’m understanding you correctly, if you’re calling a TV from a page, you could try this syntax in your document content: [*TempVar*], in other words use asterisks instead of plus signs (which would indicate a placeholder rather than a TV).
Then again, maybe you are intending to use a placeholder, in which case the typical method would be to have a snippet in which you define the placeholder, and then you can reference it similarly to your syntax above.
Hope that helps!
-
MODX Staff
- 10,725 Posts
If you’re using Ditto or NewsListing, they both provide access to the TV values of the documents you are listing; you’ll need to visit the appropriate forums or read the configuration documentation for these components for support with that.
If you are using a custom snippet, you’ll need to use the $modx API method for getting TV output from another document. See the $modx->getTemplateVarOutput() function.
Thank you very much. I will try that.
What I am trying to do is I have some articles by different authors (a folder for each author).
Each folder has a TV defined for holding author’s name. I cannot get this value to display along with the articles list on another document. I am using Ditto. Am I right here?
Thanks.
-
MODX Staff
- 10,725 Posts
You can definitely do that, but you need to get support for doing this at the Ditto support thread.