We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8384
    • 55 Posts
    On the Welcome page, ditto calls content from 'Schedule' (&parents='2') to display a listing of classes all formatted with 'classBlurbs'.

    <!-- [!currentDay!] -->
     
    [!Ditto? &parents=`2` &tpl=`classBlurbs` &filter=`pastClassTeacher,Past Class,2` &display=`all` &orderBy=`eventDateStart ASC` &tagData=`classDay` &tagDisplayDelimiter=`` &tagMode=`onlyTags` &tags=`[!currentDay!]`!]
    


    'classBlurbs' has links that will take you to either the 'Classes' [~226~] or the 'Teachers' [~83~] page AND directly to that specific class or specific teacher.

    	
    <div class="classBlurb">
    [+classBlurbImage+]<br />
        <div class="classBlurbText">
            <b>[+eventDateStart:date=`%l.%M`+] - [+eventDateEnd:date=`%l.%M %p`+]</b><br />
            <span style="font-weight:bold;"><a href="[~226~]#className[+id+]">[+pagetitle+]</a></span><br />
            <i>[+classStudio+]</i><br />
            <a href="[~83~]#theTeacher[+id+]">[+classTeacher+]</a><br />
        </div>
    </div>
    


    The problem is, when you click on the teachers name or the class name, you get taken to that page, but not to the specific teacher or class. The links work fine on the page itself, just not when coming from the welcome page.

    The actual id that is called is coming from the Schedule parent - 2, instead of the parent of 83 or 226.

    Help? I've been working on this for over a month. Client is super patient. I tried to hand it over to another MODx coder who never got back to my client. I just have to sort this out and I'm done!
      • 22427
      • 793 Posts
      In the Doc I read aobout the id parameter:
      Unique ID for this Ditto instance for connection with other scripts
      So that's not what you need.

      You could try to use documents:
      IDs of documents for Ditto to retrieve. Overrides &parents property.
      (Untested)
      • The problem is that there are multiple resources and the ones getting used on the inner page to form the anchors are different than the ones used to generate the links on the home page.
          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
          • 13226
          • 953 Posts
          Questions:

          Welcome page outputs all of the children found within ID 2 - Are 83 + 226 children of 2 ?

          Do ID's 83 + 226 output all of their children on their pages - an overview ?

          Are all of the child documents that need to be shown published or not published ?

          If you want the child ID's from parents 83 + 226 why are you calling &parents=`2` when you should be calling &parents=`83,226`

          Summary:

          If the welcome page solely outputs the ID of each child document, your solution should in theory work - I use something similar

          What your telling Ditto to do is simply output the child ID - so in theory when your output on the parent page 83 is set-up to be something like
          <div id="theTeacher121">BLAH BLAH</div>
          <div id="theTeacher122">BLAH BLAH</div>
          <div id="theTeacher123">BLAH BLAH</div>

          It should work as you then link from the welcome page to the anchor, example: "domain.com/alias.html#theTeacher121"

          If I have somehow gotten confused or missed something please let me know smiley
            • 13226
            • 953 Posts
            I think i'm looking at this wrong.

            You are telling Ditto to output the ID but you need the ID from two different documents - which means, in my opinion, it won't work.

            You have one [+id+] but want multiple ID's as you won't have one and the same ID in the parent folders, as each document has it's own bespoke ID.

            In theory - Example:
            <a href="[~226~]#className[+id+]">[+pagetitle+]</a>
            <a href="[~83~]#theTeacher[+id+]">[+classTeacher+]</a>

            Would output if criterion matched:
            <a href="alias.html#className100">Page Title</a>
            <a href="alias2.html#theTeacher200">Class Teacher</a>

            But if I am right in the way I think this works the output would be something like this:
            <a href="alias.html#className100">[+pagetitle+]</a>
            <a href="alias2.html#theTeacher100">[+classTeacher+]</a>

            Or am I just confusing things here ?

            If I am on the right line of thought, it might be achiveable with nested Ditto calls, but I have never nested Ditto calls myself. [ed. note: iusemodx last edited this post 9 years, 2 months ago.]