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
    Got it figured out, thanks to help from the guys on the MODx irc channel. Here’s the HOWTO on the Wiki.

    http://wiki.modxcms.com/index.php/Ditto_Custom_Placeholders
      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
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: sottwell at Jan 07, 2008, 12:24 PM

      No. err.... no execute Parser call in manager/index.php??
      I meant add that to the index.php, not manager/index.php
        • 18397
        • 3,250 Posts
        Not sure if the $resource is needed
        It is needed as the function must accept one value (the resource array) whether you utilize it or not.

        array("*",
        

        It might be better (and faster) to use a field that has already been retrieved, like id, in place of the *.

        Quote from: sottwell at Jan 08, 2008, 12:24 AM

        Here’s the HOWTO on the Wiki.
        http://wiki.modxcms.com/index.php/Ditto_Custom_Placeholders
        @Susan: Thank you!
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          I am still totally lost as to what all the parameters mean.

          $placeholders['example'] = array(array("pagetitle","*"),"exampleFunction","pagetitle");


          the $placeholders[’example’] part I get, that will be the name of the placeholder, and the "exampleFunction" is the name of the function you’ll write to set that placeholder’s value. It’s all the rest that is over my head.

          I just blindly used Heliotrope’s code and it worked once I got the $GLOBALS[’ditto_lang’] bit figured out from reading the ditto source, but I have no idea what that "*" is for.

          $placeholders['details'] = array("*","displayDetail");


          This extender business is a very powerful resource!
            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
            • 11975
            • 2,542 Posts
            If I understand mark answer, the => * means all field from the $resource array.

            :-)
              Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Hmm. So a print_r($resource) might prove beneficial...

              Array
              (
                  [introtext] => we are pleased to announce blah blah...
                  [id] => 366
                  [published] => 1
                  [pagetitle] => our fantastic announcement
                  [createdon] => 1193124818
              )
              Then what is that inner array, array("pagetitle","*") doing?
                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
                • 18397
                • 3,250 Posts
                In
                $placeholders['example'] = array(array("pagetitle","*"),"exampleFunction","pagetitle");
                

                the * means in both the frontend (visible result) and the backend (for filtering).


                It might be better (and faster) to use a field that has already been retrieved, like id, in place of the *.
                I mentioned this because Ditto would will try to process a non existent (the asterisk itself) field if * is the only thing in the first position of the array.