We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1841
    • 141 Posts
    I took a (shortened) screenshot in case I didn't explain sub-sub-categories very well - as mentioned though I could just make them pages alongside the reviews it was just neater having the books that belonged to a series within the series folder...

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I have much the same structure, except one more level under the subcategories, "Documentation" and "Downloads" to differentiate software from .pdf docs. Different pages offer different methods of access to the same downloads.

      I've inherited pages full of hand-coded tables and/or ugly hand-coded Javascript in a multitude of chunks, and I'm trying to modify and organize everything so I can use static resources (files stored outside of the web root for added security) with a snippet or set of snippets to form lists and tables as needed from the Tree structure, only needing to drop in a new subcategory with its related batch of static resources, all in one place, to get the new items and their files into the various lists and tables. I think this will be very close to exactly what I need!
        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
        • 1841
        • 141 Posts
        All the pages within my sub-sub-category have the TV longtitle populated where pages that are not in a sub-sub-category don't, so I came up with this:

        [[*longtitle:isnot=``:then=`[[!setPlaceholders? &ph=`prev == prev.uri !! parent2.child.uri !! parent2.prev.child-1.uri || prevtype == prev.class_key || beforeprev == prev2.uri !! parent2.child.uri !! parent2.prev.child-1.uri || next == next.uri !! parent2.child-1.uri !! parent2.next.child.uri || nexttype == next.class_key || afternext == next2.uri !! parent2.child-1.uri !! parent2.next.child.uri`]]`:else=`[[!setPlaceholders? &ph=`prev == prev.uri !! parent.prev.child-1.uri !! parent2.prev.child-1.child-1.uri || prevtype == prev.class_key || beforeprev == prev2.uri !! parent.prev.child-1.uri !! parent2.prev.child-1.child-1.uri || next == next.uri !! parent.next.child.uri !! parent2.next.child.child.uri || nexttype == next.class_key || afternext == next2.uri !! parent.next.child.uri !! parent2.next.child.child.uri`]]`]]


        It works but for some reason I've had to reverse the "parent2.child.uri" and "parent2.child-1.uri" as they were going to the opposite pages.

        I'm torn between using this or just moving the pages out of the sub-sub-category - either way fantastic work and thank you very much smiley
          • 1841
          • 141 Posts
          I took out the sub-sub-category folder level out to make life easier and not have the fully operational navigation live on the site!

          Thanks again for the help smiley
            • 35150 ☆ A M B ☆
            • 191 Posts
            Cool; I'm glad you got it working!

            I was going to say, that piece of code in my post above assumes all the resources are on the same level in the tree so having some at N and others at N+1 is what's messing it up. You could make something that'd handle those cases but you need more conditional logic than you can reasonably get with output filters in templates and you'd need to write a snippet to do it. You could start with setPlaceholders and modify it to work, using its class to do the work of retrieving all the various values.

            But getting rid of the sub-sub category simplifies things enough that you don't have to do this.

            Either way, I'm glad you've got it up and running now.

            Oh, also there shouldn't be any reason to call setPlaceholders uncached (i.e. [[!setPlaceholders ...]]); a regular cached call will be better.
              Extras :: pThumb • Resizer • imageSlim • setPlaceholders
              • 35150 ☆ A M B ☆
              • 191 Posts
              A little followup. I uploaded a new version of setPlaceholders today which includes the change mentioned above (to allow more than one fallback value), plus another couple selectors I needed for a site I'm currently building.

              Anyway, if anybody reads this thread and needs to do something similar just start with version 2.2 and you won't have to replace the snippet code with the version from GitHub; it's already in there.
                Extras :: pThumb • Resizer • imageSlim • setPlaceholders