We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20135
    • 188 Posts
    So here's what I want: I have differently designed sections on a page, and I want to set it up so that a subfolder of that page contains resources that have the content for those sections. getResources is great at listing those sections out, but only when the designs are the same - I want each design to be different, but reusable across the site.

    My thought was that I would create a number of chunks that looked like this:
    //chunk_1
    <div class="style-1">[[+content]]</div>
    
    //chunk_2
    <div class="style-2">[[+content]]</div>
    
    //chunk_3
    <div class="style-3">[[+content]]</div>
    

    Then a chunk to be used as the tpl for getResources that looked like this:
    [[$[[+tv.chunkName]]]]
    

    The chunkName TV would just be a list with just the chunk name itself being outputted.

    That was what I thought could be done, but it's not working that I can see.

    My ideal would be that rather than using individual chunks, I could put the different styles into Templates, and have getResources retrieve the template with the content. But that doesn't seem possible. So, is there a way of doing what I'm hoping can be done, where I can list out differently designed sections using getResources?

    Solution: Turns out I was using [[*content]] instead of [[+content]] on one of the chunks. So all of the above actually works properly smiley

    This question has been answered by frogabog. See the first response.

    [ed. note: moniarde last edited this post 11 years, 2 months ago.]
    • discuss.answer
      • 10208 ☆ A M B ☆
      • 1,780 Posts
      You could do it with one chunk, and a select TV for the classes to style them. Then on whatever resource, just select the style to apply to the chunk. Specify a default in the TV if you want as well, or even default it with @INHERIT which would allow child pages to inherit the parent's selected class.
      <div class="[[+selectTV]]">[[+content]]</div>
        Frogabog- MODX Websites in Portland Oregon
        "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
        Having server issues? These guys have MODX Hosting perfected - SkyToaster
        • 20135
        • 188 Posts
        Definitely, but I was only using a single div as an example. It's a Bootstrap based site, so sections wrapping containers wrapping rows wrapping columns, etc... And all look rather individual. smiley

        The above solution works, selecting the chunk name from the TV list and applying that value to a chunk call.
          • 10208 ☆ A M B ☆
          • 1,780 Posts
          That method, is rather handy for Bootstrap, I've found. The nice part is that MODX allows for it in many ways.

          I for one love chunks, but they end up out of the range of the editors which is why Content Blocks has been really helpful as of late. I control the Bootstrap and design parts, and the editors get to apply pre-coded elements which comply to the design and BS.
            Frogabog- MODX Websites in Portland Oregon
            "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
            Having server issues? These guys have MODX Hosting perfected - SkyToaster