We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12941
    • 87 Posts
    Ok, so I am using ditto and a hack in some templates to make my life easier, but it only works with a parent and a child. I can’t seem to get it to work with a parent > parent > child set up.

    Here’s the ditto hack that I dropped under parameters:

    if ($startID == "p") {$startID = $modx -> documentObject['parent'];} // allow parent as start id patch
    if ($startID == "c") {$startID = $modx -> documentObject['child'];} // allow child as start id patch


    This is how I use the hack in my ditto calls:

    [[Ditto? &startID=`c` &tpl=`team pages` display=`all` &orderBy=`ASC`]]

    This call will grab all of the child documents of a parent and run them through ditto automatically, i.e. I don’t have to make a bunch of templates with specified IDs, it will just automatically find them.

    [[Ditto? &startID=`p` &tpl=`team pages` display=`all` &orderBy=`ASC`]]

    This call is the same, it just grabs all of the documents of a parent.

    I tend to use Ditto to create navigation more than wayfinder... mostly because I just didn’t want to mess with the whole menu index thing. This may be an abstract concept if I don’t explain what I’m using it for, and perhaps there is a better way to do this altogether.

    So, I am making a website for a Soccer Club. They have different programs, and each program has teams. The way I have it set up, is that there is only one page for each team, and then one profile page for each player. The other documents I have in the parent need to display on the team pages, and the player profiles. I couldn’t make them TV’s because I can’t share TV data between documents, so I made them documents instead and used ditto to display that information, however, you would never view those pages by themselves.

    So the structure looks something like this:

    Programs
    -Teams
    --- Boys
    ----- Team A
    -------- Contact (shows up in accordian sidebar)
    -------- Accomplishments (shows up in accordian sidebar)
    -------- Links (shows up in accordian sidebar)
    -------- News (unpublished)
    -------------- News Articles Here
    -------- Players (shows up in accordian sidebar)
    -------------- Player Profile

    The only issue I’m having is that I can’t get the navigation to show up on the Players profile, because when I use the "p" parameter, it just outputs a list of all of the players, rather than contact, Accomplishments, Links, Players, etc. I need it to grab the Parent Parent (Team A) rather than just the Parent (Players).

    If worst comes to worst, I will just make a TV where you can manually input the correct ID, but it would be much easier if it could do this automatically.

    BTW, I downloaded a snippet called ParentParent that seems to do what I want, but I can’t get it to output the right ID and work in the ditto call. I also can’t seem to merge that script into Ditto as a hack... then again, my php skills are practically non-exisiting tongue




    I am using Evolution 1.0, by the way.