We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    Or you could get both of them in one snippet and output them together with their li tags, if you want to display them both together. Just surround the snippet call with the ul tags.
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 3749
      • 24,544 Posts
      Yes, If you mean "I would use 2 Snippet tags -- one to display each TV, instead of using TV tags"


      ------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using.
      MODX info for everyone: http://bobsguides.com/modx.html
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Bob, a question. What is the advantage/disadvantage of your code vs the code I had suggested for the TV @EVAL code?
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 3749
          • 24,544 Posts
          Quote from: sottwell at Jul 20, 2012, 01:44 AM
          Bob, a question. What is the advantage/disadvantage of your code vs the code I had suggested for the TV @EVAL code?

          I'm not sure. My code would avoid having to hard-code the resource ID in the TV and I think it would be easier to implement for non PHP coders (less prone to typos). I think it might be a tad faster, since it would avoid the overhead of parsing and rendering the TV and processing the @eval, but I could be wrong.


          ------------------------------------------------------------------------------------------
          PLEASE, PLEASE specify the version of MODX you are using.
          MODX info for everyone: http://bobsguides.com/modx.html
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Ah, no, I meant that code as the snippet code.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 40088
              • 708 Posts
              Quote from: BobRay at Jul 20, 2012, 01:21 AM
              [[!GetTvValue? &tvId=`12` &resourceId=`14` &render=`0`]]

              Does the above code go in the Chunk where I previously had
              [[*projectName]]


              And the below code is used "as is" in a new Snippet.

              <?php
              /* GetTvValue snippet */
              
              $rid = $scriptProperties['resourceID'];
              $render = isset($scriptProperties['render']) && $scriptProperties['render']);
              $tv = $modx->getObject('modTemplateVar', $scriptProperties['tvId']);
              
              if ($tv) {
                  return $render? $tv->renderOutput($rid)  : $tv->getValue($rid);
              } else {
                 return "TV Not Found";
              }
              


              If so, then where do I place the Snippet tag?

              Thanks
                Todd
                • 3749
                • 24,544 Posts
                The snippet tag can go anywhere you want to show the value of that TV.


                ------------------------------------------------------------------------------------------
                PLEASE, PLEASE specify the version of MODX you are using.
                MODX info for everyone: http://bobsguides.com/modx.html
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 40088
                  • 708 Posts
                  Quote from: BobRay at Jul 20, 2012, 02:06 AM
                  The snippet tag can go anywhere you want to show the value of that TV.

                  Then I'm unsure as to where this goes?

                  [[!GetTvValue? &tvId=`12` &resourceId=`14` &render=`0`]]

                    Todd
                    • 3749
                    • 24,544 Posts
                    It goes at the spot you want to display the TV value. That tag, wherever it is, will be replaced by the value of the TV.

                    I'm afraid I can't think of any other way to put it.



                    ------------------------------------------------------------------------------------------
                    PLEASE, PLEASE specify the version of MODX you are using.
                    MODX info for everyone: http://bobsguides.com/modx.html
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 40088
                      • 708 Posts
                      Quote from: BobRay at Jul 20, 2012, 02:17 AM
                      It goes at the spot you want to display the TV value. That tag, wherever it is, will be replaced by the value of the TV.

                      That's what I thought.

                      Here's where I'm confused:

                      If I place
                      [[!GetTvValue? &tvId=`12` &resourceId=`14` &render=`0`]]

                      where I want the TV value to appear and if my new Snippet is called, say, 'newSnippet', then how does MODX find/use the 'newSnippet' code if I'm not referencing it somewhere in the Chunk or Template?
                        Todd