We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32667
    • 38 Posts
    I’m running 0.9.6.1p2 and I’m having an issue with restricting Template Variables to a specific document group.


    • I have a TV named submitReview.
    • It is restricted to a template and a specific document group named ’Directory’ only
    • There are 3 documents in the document group Directory.
    • For some reason, this TV appears and is editable on all documents, instead of the 3 in the Directory group.

    Please help. This is driving me crazy!
    • You also need to create a manager user group and connect it to the document group. Then only manager users who also belong to that manager user group can see the TV. The groups are centered around users.
        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
        • 32667
        • 38 Posts
        Quote from: sottwell at Jul 23, 2008, 10:23 PM

        You also need to create a manager user group and connect it to the document group. Then only manager users who also belong to that manager user group can see the TV. The groups are centered around users.

        Thank you for the response sottwell. Much appreciated.


        • Now I have an admin user which belongs to the manager group named ’manager’
        • The ’manager’ group is linked to the document group ’Directory’, which has 3 documents in it
        • The TV named ’submitReview’ is restricted to my main template and to the document group ’Directory’

        This TV ’submitReview’ is still viewable and accessible in all documents. I only want this TV for certain documents. Any ideas?
        I can still
        • Template Variables are also tied to the documents’ Template. Have one Template for the documents that you want your TV to apply to (and assign your TV only to that Template), and assign all other documents to another Template.
          It is often the case that you may want the contents of the Template itself to be the same, but just have different TVs apply to them. This is a problem that has a few different solutions, depending on your philosophy. I usually just end up duplicating templates, because I find in the end that they change very little (most of the interesting stuff gets abstracted into Chunks or various Snippet calls.)
            Mike Schell
            Lead Developer, MODX Cloud
            Email: [email protected]
            GitHub: https://github.com/netProphET/
            Twitter: @mkschell
            • 32667
            • 38 Posts
            Quote from: netProphET at Jul 24, 2008, 08:53 PM

            Template Variables are also tied to the documents’ Template. Have one Template for the documents that you want your TV to apply to (and assign your TV only to that Template), and assign all other documents to another Template.
            It is often the case that you may want the contents of the Template itself to be the same, but just have different TVs apply to them. This is a problem that has a few different solutions, depending on your philosophy. I usually just end up duplicating templates, because I find in the end that they change very little (most of the interesting stuff gets abstracted into Chunks or various Snippet calls.)


            Thanks for the explanation netprophet. I was hoping to not have to resort to that though. I do want the template to remain the same but have TVs apply to different documents. Seems like the access/document permissions should do the trick. Has anyone restricted TVs in this manner?

            I don’t see what I am missing.
            • Yes, I do it all the time. I create a user group and a document group and connect them (in the manager permissions section). I assign my admin user to the user group, and assign the TV to the document group. Other users cannot see the TV. Or is that not what you want?

              If you only want the TV to be associated with certain documents, as netProphet says, TVs are associated with templates, not documents. All documents using a template get all of that template’s TVs. You’ll need different templates in that case.
                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
                • 32667
                • 38 Posts
                Quote from: sottwell at Jul 28, 2008, 05:14 PM

                Yes, I do it all the time. I create a user group and a document group and connect them (in the manager permissions section). I assign my admin user to the user group, and assign the TV to the document group. Other users cannot see the TV. Or is that not what you want?

                If you only want the TV to be associated with certain documents, as netProphet says, TVs are associated with templates, not documents. All documents using a template get all of that template’s TVs. You’ll need different templates in that case.

                Thank you for the explanation Sottwell. Appreciated. I’m just going to use multiple templates for my document groups.