We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33982 ☆ A M B ☆
    • 476 Posts
    I'm using MODX Revo 2.2.7.

    I'm setting up pages where T.V. values from another MODX Resource is being called on different pages throughout the site. Is the best way to do this with getResources like this:

    [[getResources? &resources=`105` &includeTVs=`1` &limit=`1` &tpl=`tv-value`]]


    Just wondering if there's a more stripped down MODX plugin or snippet that's faster and leaner. GetResources is a powerful, but I'm wondering if it's overkill for this situation. This site is a rebuild from a site that was built on Silverstripe and it's slow, so I'm looking for best methods while rebuilding on MODX. [ed. note: flinx777 last edited this post 13 years, 5 months ago.]
      Precision Web Development ... SmashStack.com
      • 30585
      • 833 Posts
      You can use getResourceField.

      Try this:

      [[getResourceField? &id=`105` &field=`myTV` &processTV=`1`]]
        A MODx Fanatic
        • 35150 ☆ A M B ☆
        • 191 Posts
        You might take a look at my extra setPlaceholders. It offers a lot more features that getResourceField and I've written it to be as fast as I know how to make it. It does some caching so you're getting multiple fields from the same resource or the same TV from multiple resources, it'll be faster than getResourceField, not to mention you can do it all in one snippet call and have the results available throughout the template as placeholders, instead of having a bunch of [[getResourceField? ]] calls scattered all around.
          Extras :: pThumb • Resizer • imageSlim • setPlaceholders
          • 33982 ☆ A M B ☆
          • 476 Posts
          Quote from: jgrant at Apr 26, 2013, 04:48 PM
          You might take a look at my extra setPlaceholders. It offers a lot more features that getResourceField and I've written it to be as fast as I know how to make it. It does some caching so you're getting multiple fields from the same resource or the same TV from multiple resources, it'll be faster than getResourceField, not to mention you can do it all in one snippet call and have the results available throughout the template as placeholders, instead of having a bunch of [[getResourceField? ]] calls scattered all around.
          That's a good point. I'll have multiple calls on the same page pulling from the other page, so I'd hate to have multiple "getResourceField" calls everywhere. Will look into that. Thanks!
            Precision Web Development ... SmashStack.com
            • 30585
            • 833 Posts
            Sounds good. setPlaceholders is definitely worth the try. I'll play with it myself when I get time.
              A MODx Fanatic
              • 3109 ☆ A M B ☆
              • 894 Posts
              From the sound of it it looks like your trying to setup a resource as a settings page probably, if that is the case I suggest you use ContextSettings or have a look at Marks ClientConfig extra.

              I also started working on something similar so you can have clients edit these settings via a resource on the front end which you can style however you want you can check it out in my gitHub repo.

              Good Luck.
                Benjamin Marte
                Interactive Media Developer
                Follow Me on Twitter | Visit my site | Learn MODX
                • 38290
                • 712 Posts
                Quote from: benmarte at Apr 26, 2013, 05:48 PM
                From the sound of it it looks like your trying to setup a resource as a settings page probably, if that is the case I suggest you use ContextSettings or have a look at Marks ClientConfig extra.

                I also started working on something similar so you can have clients edit these settings via a resource on the front end which you can style however you want you can check it out in my gitHub repo.

                Good Luck.

                Agreed. Using template variables of a resource as settings will really slow your site down and also imagine what would happen if that resource was deleted
                  jpdevries
                  • 3749
                  • 24,544 Posts
                  I agree too, but if you really need a TV from another page, here's another method: http://bobsguides.com/showtv-tutorial.html. It should be a little faster than getResourceField and *way* faster than using getResources.
                    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