We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2320
    • 47 Posts
    Sorry if it a stupid question but...
    I’m learning Ditto the hard way. I wanted to make a sort of portfolio with it. And here’s how i did it :
    1. create TV’s for custom fields (image, utl, buttons, icons,..)
    2. create a chunk for custom ditto template
    3. there i was pretty lost and i tried different things. Finally created a new template page blank with my tv’s associated.
    4. I created a folder with many pages with that template.
    5. i called Ditto on my parent and it worked apparently.

    First as i’m no pretty sure of what i’m doing...did i do everything the right way ?
    And my second and real stupid question : now that i have a lot of different pasges with my portfolio item in it if i unpublish it of course Ditto don’t see it but if i do then i can browse that page...and it’s empty of course. It’s not a big deal but is there a way to make that page not browsable if i’m clear on that.
    Thank’s for your help and answers.

    Chris
      • 7231
      • 4,205 Posts
      is there a way to make that page not browsable
      Add a redirect snippet to those docs redirecting to the page that you want.
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 2320
        • 47 Posts
        ok thanks. Seems easy. For the way i used Ditto, was it the right way though ? I couldn’t find any kind of answers on how to do what i wanted.
          • 7231
          • 4,205 Posts
          Yes, it seems right. You created containers for each portfolio and placed the documents representing each job inside. Then created a Ditto tpl to display the output you want. Then placed the Ditto call in the parent document for each portfolio. Sounds right. grin

          As for the redirect, you could also eliminate all the links that go to the ’job’ documents. It could be anoying to have a link that returns you to where you started from.
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don't know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 2320
            • 47 Posts
            Ok then. Thank you for your help.
            Euh well actually i have another question. I just tried to look for answers but i didn’t.
            I have 3 different folders with my documents in them and i’d like on my homepage to call Ditto and take randomly 1 of each folder. i understood that i can randomize my results but is there a way i can take 1 result from 3 different folder ?
              • 25663 MODX Staff
              • 12,272 Posts
              As with most things-modx, there’s typically a ton of ways to get to the same end results. Use what works best for you!

              I’m not sure Ditto can pull 1 per container. You’ll probably need to fudge it and make 3 calls.
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 7231
                • 4,205 Posts
                You could always simply use 3 Ditto calls, one for each folder. However 2 Ditto instances to return 2 results is a bit of an overkill (but will work and is easy to setup).

                Or you could use some code (php) to pic one random item from each container and create a dynamic list to be used with the &documents parameter in ditto.
                  [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                  Something is happening here, but you don't know what it is.
                  Do you, Mr. Jones? - [bob dylan]
                  • 2320
                  • 47 Posts
                  Well euh...i tried that :
                  [!Ditto? &format=`html`&tpl=`portfolio`&parents=`94,57,58,59` &summarize=`2` &randomize=`1` !]
                  

                  and i have on my homepage 2 results randomized from that 4 folders.
                  So apparently it’s possible and it works.
                  Thank you though for your help, it made me" Ditto smarter" this week.
                    • 7231
                    • 4,205 Posts
                    Good to know it works. I am always amazed at how great Ditto is.
                      [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                      Something is happening here, but you don't know what it is.
                      Do you, Mr. Jones? - [bob dylan]