We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26113
    • 88 Posts
    Is it possible to create a TV and use Ditto as the data source?

    If not, what I want to do is allow my managers, to create pages, which where an individual page would be called via drop down menu on another page.

    For example, We are creating a page where the *content* of the template would be an article. In the side bar would be a related item, like a recipe.
    I’d like for the content creator to choose the related item from the template variable list.

    Thanks
    Rich
      • 10226
      • 412 Posts
      Try using a chunk instead, chunks can be executed, unlike a TV
        • 26113
        • 88 Posts
        So I place the Ditto call in a chunk - do I reference the chunk in a TV?

        The list output is not to be displayed in the front-end, maybe I should have clarified.
        The drop list is to be used in the manager.

        Thanks
        Rich
          • 10226
          • 412 Posts
          you just execute the chunk from the page;

          {{chunk_here}}
            • 26113
            • 88 Posts
            Let me see if I can explain this differently.

            I want to create a template variable which generates a drop menu of documents starting from particular container.
            From the manager, I would choose a page from that list, which would be used to output that page id to the page content.

            If this is confusing, I apologize - I may have explained what I initially wanted incorrect.

            Thanks
            Rich
              • 22770
              • 285 Posts
              I don’t know if I understand exactly what you’re trying to do, but it is possible to use a ditto call in a TV.

              For example, here’s an example I recently used. You place this in the ’Input Option Values’ section:

              @EVAL $content_table = $modx->getFullTableName("site_content"); $result = $modx->db->select ("pagetitle, id", $content_table, "parent='40'", "pagetitle"); $dropdown=""; while($row=$modx->db->getRow($result)) {$dropdown .= "||" . $row['pagetitle'] . "==[!Ditto? &documents=`" .$row['id'] . "` &display=`1` &tpl=`profilePanel`!]";} return $dropdown;


              Choose DropDown List Menu for the ’Input Type’. What this will now do is select the pagetitle and id for all documents with a parent of 40. We then create and return a dropdown menu with the value being an appropriate ditto call. When the page editor selects the appropriate pagetitle from the dropdown, the ditto call will return the sidepanel I want (using the chunk ’profilePanel’).

              Hope that’s some help.

                • 26113
                • 88 Posts
                This is what I am looking for.
                I ended up not needing the Ditto call in the EVAL after all, since I only need to the TV to return the document id - I just out put the value of $row[’id’] to the value of the option.

                So from a snippet, I’ll look up the document id.
                Thanks for the help on this one.

                Rich