We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12147
    • 182 Posts
    Found an old thread about this, but still have a question re: TVs (I think rolleyes )

    All my pages are based on one template, and have been created. The right sidebar on the pages has boxes (5 or so) that occasionally need to be updated site-wide (not just on one page; their contents are identical on all pages). I’d prefer not to have client messing around in the template itself, but can’t figure how site-wide changes can be made otherwise.

    What is the best way to orchestrate this?

    Wendy
      • 22303 MODX Staff
      • 10,725 Posts
      Using chunks. Chunks are areas of HTML that can be edited in one location and will update all locations that they appear. Just beware of any cached content that might contain the chunk; clearing the site cache will update those as well.
        • 12147
        • 182 Posts
        Thanks, OpenGeek!

        So if I place (differently-named) chunks within each of these boxes on the template, the boxes can be edited on, say, the Clinics page, and they will then be updated to reflect those changes site-wide...am I getting this right?
          • 22303 MODX Staff
          • 10,725 Posts
          They would be edited under Resources --> Chunks tab, not on the pages, since they are not tied directly to pages.
            • 3707
            • 241 Posts
            You could use a TV with an @DOCUMENT binding http://modxcms.com/document-binding.html. This way, the document you call from the TV can be edited like any other document.
              • 12147
              • 182 Posts
              Thank you smiley

              They would be edited under Resources --> Chunks tab, not on the pages, since they are not tied directly to pages.
              My quandary is that I don’t really want the client messing around in the "guts" and I’m not sure how html-friendly they are, either...

              You could use a TV with an @DOCUMENT binding http://modxcms.com/document-binding.html. This way, the document you call from the TV can be edited like any other document.
              Sorry - I’m at the low end of the learning curve just yet...can all the documents on the site be called from the TV, then, in order to reflect edits site-wide?

              Appreciate your help laugh
              Wendy
                • 3707
                • 241 Posts
                The TV would call a single document that contains the content you want to appear in the sidebar. You then apply the TV to the template used by the pages you want the sidebar content to appear on. When you edit the document with the sidebar content, all the pages calling that document via the TV will be updated.

                So, in your example with 5 boxes in the sidebar, you would create 5 documents and 5 TVs.

                1. Create a new document and call it Sidecontent1 (or whatever is relevant). In the [*content*] area of that document, put the content you want to appear in that sidebar box. Note the ID of that document as you will use it in the TV.

                2. Create a TV and call it Sidebox1. In the ’Default Value’ field, add @DOCUMENT 12 where 12 would be the ID of the document you created in step 1.

                3. In the ’Template Access’ section, check the box next to the template or templates you want the TV to appear on and save. (Your page should look like the attached pic)

                4. Call the TV by placing [*Sidebox1*] in your template code wherever you want the sidebar content to appear.

                This will place the [*content*] section from Sidecontent1 into all the pages using the template you attached the TV to. You can then repeat the steps again for each of the boxes you want in your sidebar, obviously changing the names.
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Unfortunately the document being bound still has to be edited from the Manager, all that will show from the QuickEdit will be the @DOCUMENT binding.

                  The way I got around something similar once was to have a snippet similar to the one that checks a user’s login status and displays a chunk if he’s logged in and belongs to the right group, and that chunk had a menu of the documents in question. So the editor user would get that menu and could go to the pages to edit them with QuickEdit.

                  http://www.modxcms.com/extMemberCheck-1320.html
                    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
                    • 3707
                    • 241 Posts
                    I see how that could be a problem. Personally, I don’t care too much for front-end editing. I prefer my clients to use the manager with a limited role, having access to edit documents but not resources.

                    So the question for you Wendy is, do you want your clients to use QuickEdit or the Manager to edit the content? Of course you may want to use both.
                      • 12147
                      • 182 Posts
                      The person who is going to do most of the updating is designated as an Admin and she’ll use the Manager. I just don’t think she’s interested (or knowledgable) in messing with html, but I guess if it has to be, we’ll have to deal with it...?