We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    If the ID you want is the ID of the document Ditto is processing, how about
    $id = $modx->getPlaceholder['id']

    This is the same as using [+id+] in the Ditto view template.
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 2734
      • 165 Posts
      Quote from: sottwell at Dec 11, 2007, 01:08 AM

      If the ID you want is the ID of the document Ditto is processing, how about
      $id = $modx->getPlaceholder['id']

      This is the same as using [+id+] in the Ditto view template.

      Hi sottwell
      Thanks for the hint. I just tried this, but $modx->getPlaceholder[’id’] does not seem to return anything. I looked at the "getPlaceholder" Method inside the modx source and it seems to return a value from the "placeholders" Array. I created a snippet that simply dumps the contents of this array... when called inside a ditto template, i get some weird output:
      [tt]
      Array
      (
      [phx] => &_PHX_INTERNAL_&
      [item[0]] => <strong><a href="blog/add-a-blog-entry.html" title="Add a Blog Entry">Add a Blog Entry</a></strong>
      Add a Blog Entry


      )
      [/tt]

      As you can see, the id is not in the list of placeholders and thus not accessible. Somehow the API Doc is misleading too, because it states "array" as return value.
      It seems like you already gathered some experience using the getPlaceholder call. Could it be a PHx interference?

      Regards -- roman