We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20041
    • 83 Posts
    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. huh
    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.
      • 26016
      • 561 Posts
      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. huh
      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 and Wordpress development
        Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
        • 20041
        • 83 Posts
        embarrassed i am really sorry..
        in fact i had used [*varname*] but mistyped as i did it in a hurry.
        Still i am not getting a value...the chunk which is used to display it is called in another document..(not in which ’varname’ is defined)
        thanks a lot in advance.
          • 22303 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.
            • 20041
            • 83 Posts
            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.
              • 22303 MODX Staff
              • 10,725 Posts
              You can definitely do that, but you need to get support for doing this at the Ditto support thread.