We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20394
    • 134 Posts
    I would like a new array for the $modx object that stores the ids of the pages previously visited.
    I think a way would be to capture (with javascript) the event when we click on a local link, and to add to the target something like :
    &previousids='12,56,10,126'

    and to add these ids to the array $modx->previous_ids.
      • 22303 MODX Staff
      • 10,725 Posts
      You can achieve this now; simply use $modx->setPlaceholder() and $modx->getPlaceholder() to manage an array of previous id’s. For instance, the code:

      $modx->setPlaceholder('previous_ids', array_merge($modx->getPlaceholder('previous_ids'), array($modx->documentIdentifier)));
      


      ...could be used to add the current document ID to the list.

      You can use the $modx->placeholders array to store anything, be it a string of HTML content, a PHP array, a PHP object, etc.