We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29679
    • 7 Posts
    Okay, here’s my best shot at explaining what I want to do. :’(

    I want to have a wrapper div on the template for a modx container page.

    Within that wrapper, I want to load a row for each child of the container page. I presume that getresources is the best method for this.

    The tricky part is that I want to have those rows be formatted differently, according to the templates of the child pages.

    So if my site tree looked like

    Folder [template: post]
    - Page1 [template: row style 1]
    - Page2 [templatte:row style 2]

    my output would look like
    <div class="wrapper">
        <div class="row1">(page1 content here)</div>
        <div class="row2">(page2 content here)</div>
    </div>


    FWIW, the differences in actual row formatting are more substantial, and involve nested divs with assorted TV data.

    So far, here’s what I’ve tried:

    There’s a template for the post (with the wrapper), and templates for each of the possible row types (3 column, 2-1 split column, 1-2, 1-1-1). Each row template has an appropriate number of TVs.

    In the post template’s wrapper, I call getresources with a parent of ID, to load all the children.

    The problem is that I can’t seem pull the template formatting into the tpl chunks.

    Ideally, I’d like to have a chunk rowTpl with just [[+content]], and that would pull in everything already formatted by the template, but apparently that’s not the case.

    So is there any way to do that?

    An alternative could be something like a switch case statement within getresources, where different tpl chunks are called depending on the template of the resource being returned.
      • 29679
      • 7 Posts
      Got it working with output filters:

      [[+template:is=`5`:then=`
      // make one kind of row
      `:else=``]]
      
      [[+template:is=`6`:then=`
      // make a different kind of row
      `:else=``]]
      
      [[+template:is=`7`:then=`
      // make a different kind of row
      `:else=``]]
        • 4172
        • 5,888 Posts
        don’t know if this will work, but perhaps you can put this in your getResourcesTpl:

        [[$mychunk_[[+template]]]]


        and name your different chunks mychunk_5 mychunk_6 mychunk_7
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!