We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11316
    • 81 Posts
    I am trying to find a way to place a ditto call to a container to auto/self recognize it’s id.

    [!Ditto? &parents=`[~id~]` (is there any way to have this auto/self recognize that it is id ’2’) &display=`1` &paginate=`1` &paginateAlwaysShowLinks=`0`!]
    [+previous+] [+pages+] [+next+]

    The Goal:
    Setup a unpublished template container (with all my pre made pages) have my client duplicate the container and update the inside template pages and just start clicking publish...

    Any help appreciated, and if it’s already been done can someone point me in the right direction.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      [~id~] wouldn’t give you anything (unless an error); the [~...~] tags take a document ID and make a URL out of it. If you wanted a URL, you would need to use nested tags: [~[*id*]~] - this would get the ID of the current page (the one the Ditto call is on) and make a URL out of it. If you just want the ID of the current page, use [*id*].

      Actually, I do believe that Ditto will automatically use the page its call is on as the parent if that parameter is left out.
        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
        • 11316
        • 81 Posts
        I feel so silly, just removed the &parents part you suggested and it worked perfect.
        No worries I will smack myself over the head for you. Thank you so much for your quick response.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          No worries; I was once upon a time working on my first MODx sites myself wink wink
            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
            • 10413
            • 1 Posts
            I have a similar question. I’m sorry in advance for the supid one but this is my first site on ModX.

            I am outputting the "See also" block and I’m trying to filter the current id not to print the current documents link. Despite I read the article and tried out both ways — although none of them work in my case. However if I put the current id by hands instead of the [*id*] part in the mentioned code, everything works out fine.

            My initial piece of code:
            [[Ditto? &startID=`58` &tpl=`smTakJeRow` &sortBy=`PubDate` &summarize=`15` &dateFormat=`%d.%m.%Y` &dateSource=`pub_date` &filter=`id,[*id*],2`]]


            I tried to put id those ways:
            1. [*id*]
            2. [~[*id*]~]
            3. Manually 59 - it works!

            I need someone’s professional advice please how to solve this in a proper way. Thanks!

            UPD: Solved. The thing was in the [[ at the beggining and ]] at the end. Changed to [! .... !] and everything started working.