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

    On a previous site I needed to put in a left hand sidebar for each page, and so was part of the template. The site content editor was allowed to choose which chunks they wanted to appear in the sidebar. For example, in the left hand sidebar for the home page, they would choose a submenu, a login box, and a featured item chunk.


    I did this by putting each chunk that was allowed to be a sidebar chunk into a "sidebar" category (say category id 6). Then I had three drop-down menu TVs (sidebar1, sidebar2 and sidebar3), where the input value option was:

    @SELECT name from site_htmlsnippets where category='6'
    


    I also had an empty chunk in the category for "I don’t want a chunk at this position".

    Then the template would look like this in the sidebar:

    <div id="sidebar">
    {{[*sidebar1*]}}
    {{[*sidebar2*]}}
    {{[*sidebar3*]}}
    </div>
    


    So it worked, and was manageable - if a new sidebar chunk was required, I would just add it to the sidebar category (6) and it would appear as selectable when editing a page in for each of the three sidebar positions.

    However, it is clearly a cludge, and I was thinking people here might have some tips as to a better approach...

    Paul



      • 26931
      • 2,314 Posts
      Hi Paul,

      have a look at "TV-Based Chunks" http://wiki.modxcms.com/index.php/Create_TV-Based_Chunks
        • 22827
        • 129 Posts
        Oh yeah thanks.

        That does seem like a more complex way to do what I am doing with a single TV. And my method allows the chunk order to be in the order I want (albeit is limited to how many positions I define).

        Thats the trade off I guess.