We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41870
    • 16 Posts
    A complete newbie question, sorry..
    Let's say I have a page that has a category 'we do' and then several subcategories, because we do a lot. Click on 'we do' brings out short descriptions of them all.
    Is it possible to create a TV (say, rich test or image) that can be edited on one page (subcategory) that uses one template and then be reused in other pages (subcategories) that have different templates, without having to do the exact same edit on these pages?

    I hope my question is not too confusing.. I have googled and searched this forum for days without much luck. This is probably not what I'm looking for: http://wiki.modxcms.com/index.php/Create_TV-Based_Chunks#Create_Some_Chunks

    Probably very simple thing.
      • 22427
      • 793 Posts
      Use the snippet getResourceField, say like
      [[getResourceField? &id=`42` &field=`myTV` &isTV=`1` &processTV=`1`]]
      where 42 is to be replaced by the ID of the page which the TV is edited on.
        • 41870
        • 16 Posts
        Quote from: ottogal at Nov 15, 2012, 04:17 AM
        Use the snippet getResourceField, say like
        [[getResourceField? &id=`42` &field=`myTV` &isTV=`1` &processTV=`1`]]
        where 42 is to be replaced by the ID of the page which the TV is edited on.

        Thank you ottogal, but isn't that snippet only for Revolution? Should I 'upgrade' before it's too late? [ed. note: konservin last edited this post 13 years, 10 months ago.]
          • 4172
          • 5,888 Posts
          for Evo there is the getField - snippet
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 3749
            • 24,544 Posts
            It seems to me that putting all that info in a chunk would be the way to go.

            Then you could display it anywhere with a chunk tag.
              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
              • 21417
              • 486 Posts
              Creating the content in a chunk would allow for repeating without having to edit multiple items, although you would not have access to the WYSIWYG editor and you can even use the WYSIWYG editor for chunks by selecting Rick Text Editor below the text field (thanks kp52 wink ).

              Another option that might work could be to use a template variable (tv) (presuming the site structure is hierachical):

              1. create a tv with input type "Rich text"
              2. attach that tv to the parent category template (and to the sub category template if different)
              3. type the content into the rich text tv field on the parent resource
              4. add "@inherit" in the tv field on the sub category resource
                (@inherit tells the resource to get the information from its parent. I am not sure if @inherit can be used directly in a rich text field. If not, you may need to make the sub category pages non rich text)

              Good luck! [ed. note: nickf08 last edited this post 13 years, 10 months ago.]
                Web design Adelaide
                http://gocreate.com.au
                • 16278
                • 928 Posts
                Quote from: nickf08 at Nov 16, 2012, 03:55 PM
                Creating the content in a chunk would allow for repeating without having to edit multiple items, although you would not have access to the WYSIWYG editor.

                You do have the option to choose your editor under the text-entry box of a chunk, just the same as in the Content field of a resource. The RTE's output is just HTML, after all.

                ;) KP
                  • 21417
                  • 486 Posts
                  I need to scroll a little further - ha ha!
                  Thanks kp52, I never knew you could use the WYSIWYG with chunks.
                  That's going to be handy.
                    Web design Adelaide
                    http://gocreate.com.au
                    • 10208 ☆ A M B ☆
                    • 1,780 Posts
                    This recent thread where I discovered that a single TV can be called globally in multiple templates regardless of which template it's assigned to might be of interest to you.
                    https://forums.modx.com/thread/80330/tv-default-value-returned-when-accessing-from-a-template-that-doesn-t-have-it-assigned

                    It sounds like you're wanting to assign a TV to one template and set it once, yet be able to call it on any other template and always output what is set in the assigned template/resource, correct? If so, just assign the TV to the template you want to use to set the TV, set it/insert code, then call the TV in the templates that should output it.

                    Some would consider this a little annoying, but others consider it a happy mistake.

                    Read the bug report mentioned towards the end of the thread for clarity.
                      Frogabog- MODX Websites in Portland Oregon
                      "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
                      Having server issues? These guys have MODX Hosting perfected - SkyToaster