We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10189
    • 109 Posts
    I’m working on a project that uses MODx 0.9.6.3. I’ve got this idea where the site tree in the manager has a container called "Teasers" that contains a number of pages that acts as, you guessed it, teasers. smiley I’d like for my client to be able to choose which one of these teasers that should appear when he creates/edits a normal page. I’m just not sure how to solve this.

    I used Ditto for another project to list teasers in a similar manner, picking them from a container in the tree called "Teasers". Only thing was, the client could not choose specific teasers for specific pages. If they we’re published, they’d be listed on every page that had the Ditto call.

    Now, I know that I could use a unique "Teasers" container for each page (the site doesn’t have that many subpages, maybe 4-5) and use the previous mentioned solution with Ditto. Then again, some teasers would be duplicates that needed to be edited twice. I think you see the problem.

    I’m foreseeing some issues with my idea. A TV would have to parse the "Teasers" container and create a list of checkbox items that corresponds to the teasers that should be shown on the page, and that might not be so easy to achive. I’m hopeful though that there’s a way. laugh

    I hope I managed to explain what I’m trying to achieve clearly enough, and that someone might have some ideas. smiley
      • 7231
      • 4,205 Posts
      There is a method described in the Wiki that allows you to select which chunks are displayed on a page via a set of check boxes. I think this may be what you are looking for.

      http://wiki.modxcms.com/index.php/Create_TV-Based_Chunks
        [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]
        • 10189
        • 109 Posts
        Thanks for your reply, dev_cw. smiley I’ve read that article before, but I believe the problem here is that they are using chunks, while I want to use regular pages. :/
          • 7231
          • 4,205 Posts
          We can modify the method to use document rather than chunks by feeding the TV with the document tree (either using the @SELECT binding or the @EVAL binding to run a snippet (look at the snippet named ddTree or Quill).

          Then modify the snippet to load the document fields you need (can even use getField for this).
            [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]
            • 10189
            • 109 Posts
            Sounds great! I will take a look at this tomorrow when I’m not at the office. Thanks! smiley
              • 37550 ☆ A M B ☆
              • 711 Posts
              If you want to show specific teasers then you could always have the client run a Ditto call on the page specifying the documentid to show i.e. &documentID=`57,41,21` instead of using startID which runs through an entire folder
                http://www.onesmarthost.co.uk
                UK MODX Hosting with love.
                • 10189
                • 109 Posts
                So I would have the customer put the ID:s of the teasers he would want to show in a TV field then?
                  • 37550 ☆ A M B ☆
                  • 711 Posts
                  It depends if you dont want your customer to have to enter a ditto call within the page where they want to promote / show teasers then you could us a TV for example called teaserids which is text, with widget delimited list ,

                  then in your template have something like

                  [[Ditto? &documents=`[*teaserids*]` &tpl=`tpl_teaser`]]

                  For a site I have worked on recently the end user is quite happy enter the ditto calls anywhere they want i.e. in the content the would enter:


                  <h1>teaser content</h1>
                  <p>here are our latest teasers.</p>
                  [[Ditto? &documents=`71,93` &tpl=`tpl_teaser`]]

                  Hope that helps

                  Aaron
                    http://www.onesmarthost.co.uk
                    UK MODX Hosting with love.
                    • 10189
                    • 109 Posts
                    Onesmarthost, you’re a genius! I used your Ditto call along with ddTree that dev_cw mentioned, and hey presto, a checkbox list that provides the ID for my teasers! Just perfect! laugh
                      • 30107
                      • 44 Posts
                      Quote from: Onesmarthost at Apr 03, 2009, 09:29 AM

                      It depends if you dont want your customer to have to enter a ditto call within the page where they want to promote / show teasers then you could us a TV for example called teaserids which is text, with widget delimited list ,

                      then in your template have something like

                      [[Ditto? &documents=`[*teaserids*]` &tpl=`tpl_teaser`]]

                      For a site I have worked on recently the end user is quite happy enter the ditto calls anywhere they want i.e. in the content the would enter:


                      <h1>teaser content</h1>
                      <p>here are our latest teasers.</p>
                      [[Ditto? &documents=`71,93` &tpl=`tpl_teaser`]]

                      Hope that helps

                      Aaron

                      Hi,

                      I like the idea, because it’s so simple to maintain. But ditto uses it’s own order: if id 93 is more recent than id 71, it’s first in ouput by default. ditto’s order option &orderBy doesn’t help in this case.

                      How can I manage ditto to ouput in the given order "71,93"?