We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25803 ☆ A M B ☆
    • 721 Posts
    Hello,

    I’m not sure if this would be done by Ditto or not but here is the scenario:

    Have a section of the Web Site called Case Studies, under which will be numerous documents, each a case study.

    Case Studies (7)
    |
    ------ Case Study A (Latest Published)
    ------ Case Study B (Published Last Month)
    ------ Case Study C (Published 2 Months ago)

    The list of case studies, current and past appears in the side menu.

    What I want to happen is the latest Case Study published to show up when the user clicks Case Studies, so, in effect, the latest child document has to be the document that is displayed by the containing folder.

    Any solutions to doing this?
      • 1122
      • 209 Posts
      You need to build separate page template for your container "Case Studies" (id=7). In that template, in its places where you would normally put template variables like
      [*pagetitle*]
      [*content*]
      ...
      you should call Ditto
      [!Ditto? &parents=`[*id*]` &depth=`1` &display=`1` &tpl=`@CODE:[+pagetitle+]` &sortBy=`createdon` &sortDir=`DESC`!]
      [!Ditto? &parents=`[*id*]` &depth=`1` &display=`1` &tpl=`@CODE:[+content+]` &sortBy=`createdon` &sortDir=`DESC`!]
      ...
      

      respectively.
      Apply such a template to your container id=7 and you are done.
        • 25803 ☆ A M B ☆
        • 721 Posts
        Quote from: alik at Feb 02, 2010, 11:59 AM

        You need to build separate page template for your container "Case Studies" (id=7). In that template, in its places where you would normally put template variables like
        [*pagetitle*]
        [*content*]
        ...
        you should call Ditto
        [!Ditto? &parents=`[*id*]` &depth=`1` &display=`1` &tpl=`@CODE:[+pagetitle+]` &sortBy=`createdon` &sortDir=`DESC`!]
        [!Ditto? &parents=`[*id*]` &depth=`1` &display=`1` &tpl=`@CODE:[+content+]` &sortBy=`createdon` &sortDir=`DESC`!]
        ...
        

        respectively.
        Apply such a template to your container id=7 and you are done.

        Thanks. I actually had been wrestling with that, but only trying it with content initially but I continue to get this error:

        &tpl either does not contain any placeholders or is an invalid chunk name, code block, or filename. Please check it.


        I understand how to create template chunks and files but with @CODE am I supposed to do something as well?
          • 1122
          • 209 Posts
          This is a tested and working solution and I feel that you did not read the post carefully. I have not written that you should create any chunks or files. Ditto calls should be used within page template (Elements/ Manage Elements/ Templates) created specially for displaying page id=7.
            • 25803 ☆ A M B ☆
            • 721 Posts
            Quote from: alik at Feb 03, 2010, 01:17 AM

            This is a tested and working solution and I feel that you did not read the post carefully. I have not written that you should create any chunks or files. Ditto calls should be used within page template (Elements/ Manage Elements/ Templates) created specially for displaying page id=7.

            Yes, thanks, that’s exactly what I did, and when it didn’t work I thought about template chunks or files because of the error so I understood your post perfectly. I created a new template, wiped out the usual elements such as content and used those Ditto calls. Perhaps because I have PHx it is doing something odd. No matter, I’ll find another solution. Thanks.