We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12556
    • 103 Posts
    Hey guys.  I want to be able to pull document properties for several different documents into one page.  The @Document binding works great for the content but I want to be able to, separately, grab the title, long title and description of the documents as well.  I tried using @SELECT to pull it right out of the database but that, as one would guess, returns an array and I don’t seem to be able to write any PHP to extract the data in the binding.  Suggestions?  Thanks!

    Okay, I thought I was posting under General Support. Sorry. Would someone mind moving this? Thanks!
      • 11975
      • 2,542 Posts
      Hi,

      you could proceed as follow

      1/ set tv type to multiple select and output widget to delimited list, Use ddTree in backend to select the documents you want to display
      2/ Use Ditto to render the selected documents

      [[Ditto? &documents=`[*tvName*]` ]]

      :-)
        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
        • 12556
        • 103 Posts
        Not sure I’m following that.

        It might be better to explain what it is I’m trying to do exactly and just see what you guys think is the best way to accomplish this. I’m building a portfolio section for a client and there are 12 projects that will be displayed on this page. I have 12 corresponding documents set up in the manager that I want to use to populate the portfolio. The page itself is set up in such a way that editing it directly from the manager won’t work so I’m using these documents so that the client can edit the projects at will. I want to use the document titles to populate the navigation, the long titles for the title of each piece, the description as a subtitle and the document content as the project’s description. What say you guys?
          • 22303 MODX Staff
          • 10,725 Posts
          I believe Heliotrope is directing you in the proper direction. Ditto is exactly what you need; it is a very flexible document aggregation script that can grab all of these properties from multiple documents that represent individual portfolio items and present a summary view of them using whatever templates you want to produce the output. Then the portfolio items themselves can have a template that produces the individual views when accessed.

          If you are wanting to produce one view to render each of the individual portfolio documents (rather than making those documents render their own output), you’ll need to write a script to get the TV output (see $modx->getTemplateVarOutput()) and render it how you want to. However, I recommend letting the documents represent each portfolio item and rendering them with a template directly and using Ditto to present any aggregations. This will be more efficient unless the number of portfolio items is going to grow into the thousands, at which point, a custom database table representing portfolio items would be a much better solution.
            • 12556
            • 103 Posts
            Thanks for the suggestions! I managed to implement Ditto in this way and it worked perfectly.