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

    I am switching to ModX but one thing I am not clear about is how to control snippet/chunk display. Let me explain this.

    Say I am creating a 10 page site. Further say I am displaying 2 chunks, say chunk 1 on page 1, 2 and 4; chunk 2 on page 2, 5,7. Here chunk 1 and 2 both are displayed on page 2. How can I control which chunk will display on what pages?

    I need this for both chunks as well as snippets.

    What I am looking for is something similar to how in Joomla we can decide where a module will show.

    I know one way is to have a different template. However for a 300 page site and for 20 modules which may overlap with various combinations, this is not practical.

    There must be another way to do this that I haven’t figured out. Please suggest.

    - Amit
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Use TVs. You can either just put the chunk tags in the TV, or use @CHUNK binding. I have a tutorial on making a TV provide a set of check boxes for specifying which chunks to put on a resource being edited.

      http://www.sottwell.com/how-template-variables-work.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
        • 1383
        • 5 Posts
        How?

        Do I create a TV for every chunk I want, then in the TV I specify the ID’s for pages the chunk will display in? I can’t put any logic in a chunk, then this won’t work.

        I am not super familiar with chunk binding so maybe I am confused. I am specifying chunk bindings then won’t I need to modify each page when I need to change the pages where that chunk is supposed to show. For example in my scenario if I need to change chunk 2 to show in page 2, 8 and 9, then won’t I need to change all the 3 pages (actually 2) plus the pages where I remove this from?

        Or am I confused?

        I was more looking at a central place to control the display much like Joomla Modules.

        Thanks
        Amit
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          No. Create one TV with an input type of check box. Each check box will indicate whether or not to use the chunk it is associated with. The article I linked to walks you through creating such a TV.
            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
            • 1383
            • 5 Posts
            Thanks for your reply.
            This is what I am confused.
            I understand I can create a chunk and then associate it with each page via TV. But if I need to remove the chunk from say page 2,3 and 4, I will need to open each of these pages (2,3 and 4) and uncheck the box, right?

            Quote from: sottwell at Apr 11, 2010, 12:50 PM

            No. Create one TV with an input type of check box. Each check box will indicate whether or not to use the chunk it is associated with. The article I linked to walks you through creating such a TV.

            Thanks.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Yes.
                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