We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32645
    • 377 Posts
    I have a page which is structured thusly;


    Article
    ..Category
    ....Page 1
    ....Page 2
    ..Category
    ....Page 1
    etc

    I need Ditto to list the articles by category first, so it reflects the structure displayed in the tree.

    So in other words, display the parent category, and then list all its children.

    Like this;


    [Category title]
    [Child]
    [Child]
    [Child]
    [Child]
    ...etc...
    ---

    [Category title]
    [Child]
    ..etc ..


    What is the best way to do this with Ditto?
      • 32645
      • 377 Posts
      Using wayfinder, I am able to output all the categories

      [[Wayfinder? &startId=`36`]]
      


      Returns


      * Wallpapers
      o Example download 1
      o Example download 2
      * Screensavers
      o Example screensaver 1
      o Example screensaver 2

      But I need to output the children in a Ditto template style.

      Unless there is another way to output each category and its children?
        • 4172
        • 5,888 Posts
        you could have an outer ditto-call for categories and a nested ditto-call in the outer ditto-chunk for the childs
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 32645
          • 377 Posts
          Hi there.

          Thanks for your help. This helped alot -- up to now I’ve been using a combination of Wayfinder and Ditto, the result of which was a lot of chunk templates.

          But the way I resolved it was to have a ditto call in the main category that is limited to one level, and in the lower categories I created a ditto call to that categories children.

          This worked fine.

          // This sits in the parent page
          [!Ditto? &parent=`[*id*]` &sortBy=`menuindex` &sortDir=`ASC` &tpl=`Download_DittoOuterTpl` !]
          
          // This sits in Download_DittoInnerTpl
          [[Ditto? &parents=`[+id+]` &tpl=`Download_DittoInnerTpl` ]]
          
          // This sits in in the Download_DittoInnerTpl
          <p>
          [+title+]
          </p>
          
          <p>
          [+content+]
          </p>
          
          


          I am now resolving a problem relating to the way the templates are displaying.

          I have now resolved the problem. Thanks to all who responded.
            • 7019
            • 135 Posts
            hellow,

            i have a problem with this.

            at this moment i have the following:

            links
            ..categorie 1
            .....link 1
            .....link 2
            ..categorie 2
            .....link 1
            .....link 2

            in the code of the category-pages i have the following:

            [[Ditto? &parent=`[*id*]` &sortBy=`menuindex` &depth=`1` &sortDir=`ASC` &tpl=`links_category_outer` &noResults=`No links`]]


            in chunk links_category_outer i have the following:

            [[Ditto? &parents=`[+id+]` &tpl=`links_category_inner` ]]


            in chunk links_category_inner i have the following:

            <h5>[+title+]</h5>




            but nothins works. their is no link on this page (not even the category)

            can anyone tell me what i do wrong?

            thanks