We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20448
    • 48 Posts
    Hi All

    I am just learning how to change my templates in Modx. I am a bit stuck on how to add more content that is editable for the user in the same way as the [*content*] template variable.

    I have create a TV with editable content but the editor can be seen on the website.

    Should I use a chunk or a Template variable. Ideally I want to copy the content TV.

    Any help would be greatly appreciated

    Thanks

    Phil
      Get your business online - Adapt Web Design www.Adaptwebdesign.com
      • 27708 MODX Staff
      • 2,502 Posts
      Template variables are custom content fields that allow unique, per document content. Chunks are HTML blocks that are used where they are placed in a document or template.

      As an example you would use a TV for a product id, image or an authorname that relates to the MODx document. You could use a chunk to contain a common block that appears in more than one place on your site.

      In either case, to display content on the website from Chunks or TVs you need to put the call into the template. [*tvname*] for a (exactly as you have [*content*] in your template) and {{chunkName}}. Chunks can also be used within the content field, TVs and other chunks.

      Hope this helps.

      Cheers,

      jay
        Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        A TV will have a field on the document’s editing page in the Manager, just like the normal Content field (you can specify what kind of field you want it to be). Editing the TV field will only change it for that document. The content of the TV will be displayed in the [*tvname*] tags, just as the [*content*] tag displays the text from the document’s Content field. If you specify a Default Value when you create the TV, then all documents will display that value unless it is edited at the document level.

        The format of what is displayed on the final webpage depends on the output Widget you chose when you created the TV.

        Chunks can only be edited from the Elements -> Chunks tab, and are always the same across all documents where the {{chunkname}} tags are inserted.



          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
          • 21191
          • 236 Posts
          We use chunks for recurring content, and TV’s for varying content, but it depends from case to case.

          However to add some new commentary to the subject we also use the DyNContent Snippet to let our end users manage "chunk" like content through the Document system. This way my end user can edit the footer directly, or other "special" content like maybe a phone number or something. We did it here with the "I’m new" content http://realchurch.org
            ~Shawn Himmelberger
            Check out my MODx Development and MODx Design Company - Himmelberger Design
            • 20448
            • 48 Posts
            Thanks folks for the advice.

            What I am looking for is for the client to update their website and the TV looks more user friendly to update the content rather than chunks. Is this the case?
              Get your business online - Adapt Web Design www.Adaptwebdesign.com
              • 27708 MODX Staff
              • 2,502 Posts
              TVs can be easier to update as they relate to the documents and you can set them to use default content.
                Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
                • 20448
                • 48 Posts
                How do I duplicate the content TV and use it to update another section of the site?
                  Get your business online - Adapt Web Design www.Adaptwebdesign.com
                  • 3749
                  • 24,544 Posts
                  You need a snippet call on the page that uses a snippet to get the TV from the other page.

                  The getField snippet will do it, although there may be something simpler:

                  http://modxcms.com/extras/package/173

                    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
                    • 20448
                    • 48 Posts
                    Hi Bob

                    Thanks for the response. See the image, I am trying to add content to the left of the template but not so that anyone can edit the are. The section on the left is a chunk with a Richtext area. The Welcome text is the standard content box. What I really want to do is have the Content chunk on the left and right of the content.

                    Can you help?
                      Get your business online - Adapt Web Design www.Adaptwebdesign.com
                      • 27708 MODX Staff
                      • 2,502 Posts
                      Are these sections that will be unique to the home page or appear on every page on the site? What will appear here specifically.

                      If it will only appear on the homepage you can hardcode it into a separate template for just the home page.

                      If it will be on some pages you could create a TV in which to place the chunk data and then once you are ready to turn the site over tot he client use the ManagerManager plugin to hide the fields you don’t want them to touch.

                      The image is helpful but the content itself (what the purpose is and how it relates to your site makes all the difference in how you might set this up).

                      Cheers,

                      Jay
                        Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub