We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28203
    • 26 Posts
    I really can’t get how placeholders work. I mean, I do know that they are an array value of something, but where are they defined??

    In the chunk ditto_blog we have:

    <div class="ditto_summaryPost">
    <h3><a href="[~[+id+]~]" title="[+title+]">[+title+]</a></h3>
    <div class="ditto_info" >By <strong>[+author+]</strong> on [+date+]. <a href="[~[+id+]~]#commentsAnchor">Comments
    ([!Jot?&docid=`[+id+]`&action=`count-comments`!])</a></div><div class="ditto_tags">Tags: [+tagLinks+]</div>
    [+summary+]
    <p class="ditto_link">[+link+]</p>
    </div>

    This is used by ditto to display the posts.

    So lets say I want to display only the value of the placeholder [+author+] without using ditto on my single post pages. If i call that in the template, it displays nothing.
    How would I find out how does [+author+] gets its value, where is that defined?? Or [+date+] or any of these placeholders??
      • 28107
      • 230 Posts
        CONIN Werbeagentur . Köln
        http://www.conin.de
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Placeholders are set by the snippet code, using $modx->setPlaceholder(’placeholder-name’, ’placeholder-value’).

        If you just want to use one of the document’s fields, then the [*fieldname*] is what you want. If you want one of the snippet’s calculated placeholders, then you have to run the snippet (or create your own to generate that one value if that’s all you want).
          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
          • 28203
          • 26 Posts
          Yes, I think I got it now, I did a search for the term author in ditto’s files and came up with the function.

          How stupid of me, I forgot that there are more files to the ditto snippet.


          Quote from: sottwell at Apr 28, 2008, 01:21 AM

          If you just want to use one of the document’s fields, then the [*fieldname*] is what you want.

          How can I find the available document fields and how exactly should I call them?

          For example is there a way and how would I call the Full Name of the user creator of the document?
            • 7231
            • 4,205 Posts
            The link in my sig has a list of most (if not all) available document specific variables (it is in the documentation), and you can create your own Template Variables as well. One thing to remember is to use the [* *] syntax directly in a document and the [+ +] syntax when using them in a snippet’s output.

            As for posting the author’s name, there may be a snippet that can retrieve the users name based on the ID (only the ID is available as a document variable):

            createdby - The user ID of the creator of the document.
              [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]