We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30497
    • 245 Posts
    I have a ditto chunk where I need to get the long title, or even the pagetitle, of the parent for each ditto item. Using [+parent+] calls the unique ID of the parent, "7" in this case. I tried searching for a way to customize this in ditto, or some other method, but I came up with nothing.

    Any suggestions?
      • 3707
      • 241 Posts
      You could try using PHx. Create a snippet called phx:docfield and add this code:
      <?php
      $field = (strlen($options)>0) ? $options : 'pagetitle';
      $docfield = $modx->getTemplateVarOutput(array($field), $output, 1);
      return $docfield[$field];
      ?>

      Then in your ditto chunk, use:
      [+parent:docfield=`longtitle`+]

      The snippet is set to use pagetitle as the default field if none is specified in the placeholder.
        • 30497
        • 245 Posts
        thank alot!
          • 7231
          • 4,205 Posts
          There is also the GetField snippet.
            [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&#39;t know what it is.
            Do you, Mr. Jones? - [bob dylan]