We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1841
    • 141 Posts
    Hi jgrant,

    I appreciate the valuable input!. I tried:

    [[setPlaceholders? &ph=`
        prev == prev.uri !! parent.prev.child-1.uri ||
        next == next.uri !! parent.next.child.uri
    `]]
     
    [[+prev:!empty=`<a href="[[+prev]]">Previous</a>`]]
    [[+next:!empty=`<a href="[[+next]]">Next</a>`]]


    It works pretty well, granted that it won't break out of A/B etc however it does work very well indeed I would be very interested in the jump between A/B to C/D. I was thinking about this though and I could just have a folder with a weblink at each end that redirects to the first review in the next folder / last review in the previous folder.
      • 1841
      • 141 Posts
      The only slight bug bear I am having is that occasionally I have a series folder that is setup as a weblink (where for example an author has written within a shared universe series) which prevents me from having more than one page with the same content. I could look at changing this anyway but is there an easy way to skip if the page is weblink or skip if template=8 for example?
        • 35150 ☆ A M B ☆
        • 191 Posts
        Quote from: antsplace at Sep 10, 2013, 01:49 AM
        It works pretty well, granted that it won't break out of A/B etc however it does work very well indeed I would be very interested in the jump between A/B to C/D.

        There's an easy change I can make to the snippet which will allow multiple fallbacks which is what this needs to work. I can send you the change later today or tomorrow if you like.

        On the weblinks, they would be easy enough to skip using this approach only if the following are true:

        • there's never more than one weblink in a row
        • the first and last resource in a folder is never a weblink
        Otherwise you'd need to write a snippet since you need variables and some loop structure. You could start by copying the setPlaceholders snippet and using its class to do all the work of looking up different values. You'd just have to write some logic around that.
          Extras :: pThumb • Resizer • imageSlim • setPlaceholders
          • 1841
          • 141 Posts
          Hi Jgrant,

          That would be fantastic! If we can traverse out the a/b folders there would be no need for weblinks as first or last resource and there would never be two in a row.
            • 35150 ☆ A M B ☆
            • 191 Posts
            Ok, I made that change. Edit the setPlaceholders snippet in the manager and replace the contents with the new version. I haven't tested it super thoroughly yet, but it seems ok.

            That will allow this to work and jump between resources, subcategories and now categories
            [[setPlaceholders? &ph=`
                prev == prev.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
            `]]
            
            [[+prev:!empty=`<a href="[[+prev]]">Previous</a>`]]
            [[+next:!empty=`<a href="[[+next]]">Next</a>`]]
            


            If you want to skip weblinks, in theory this monster should work:
            [[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
            `]]
            
            [[+prev:!empty=`<a href="[[+prevtype:eq=`modWebLink`:then=`[[+beforeprev]]`:else=`[[+prev]]`]]">Previous</a>`]]
            [[+next:!empty=`<a href="[[+nexttype:eq=`modWebLink`:then=`[[+afternext]]`:else=`[[+next]]`]]">Next</a>`]]
            


            Let me know what happens if you run that : )
              Extras :: pThumb • Resizer • imageSlim • setPlaceholders
              • 1841
              • 141 Posts
              Hi Jgrant,

              Thanks again for the help, it is much appreciated. I've tried running the update and while it does skip weblinks ok it still doesn't break out of the 2nd level (A/B)
                • 35150 ☆ A M B ☆
                • 191 Posts
                Quote from: antsplace at Sep 11, 2013, 02:45 AM
                Thanks again for the help, it is much appreciated. I've tried running the update and while it does skip weblinks ok it still doesn't break out of the 2nd level (A/B)

                Well, that's disappointing. Let me take think about it tonight and figure out why that's not working.
                  Extras :: pThumb • Resizer • imageSlim • setPlaceholders
                  • 1841
                  • 141 Posts
                  Hi Jgrant,

                  Thank you!
                    • 35150 ☆ A M B ☆
                    • 191 Posts
                    Maybe I didn't understand your resource tree structure properly? I set up a test with this structure and it works fine:


                    It does previous/next navigation between all the "Page ..." resources, skipping over the one weblink. So if you started at resource 31 and kept hitting Next you'd go through 31, 21, 32, 33, 22, 25, 26, 27, 28.

                    You put the new version of the setPlaceholders snippet in right?
                      Extras :: pThumb • Resizer • imageSlim • setPlaceholders
                      • 1841
                      • 141 Posts
                      Hi Jgrant,

                      Yes I've got a very similar folder structure - with just two exceptions 1: that the category and subcategory folders are set to hide from menu & 2: that occasionally within the sub-cat folder there may be a sub-sub-cat (book series).

                      I did put the new code in and cleared all cache's however I've just again pasted the code and it does manage to skip weblinks AND go to the next category! The only thing it doesn't do is move back up when in a sub-sub-category folder unless there is another sub-sub-category folder next or previous. I could look at changing this and just have the sub-sub-category as a page and not a container (moving the documents they hold to the same level) if it was an issue.

                      Thanks again for all the help, it's a fantastic plugin for modx!