We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13137
    • 204 Posts
    That did it. Thanks.

    I didnt realize that you needed to add "? &homeId=`16`"
    I was trying to change it inside of the spippet.
      • 23703
      • 180 Posts
      When using Breadcrumbs with a different homeId than the start page I ran into a weird issue. Using your example from a few posts back, ie

      - Home (1)
      - - English (7)
      - - - Products (2)
      - - - - Widgets (3)
      - - - - - Thing-a-ma-bob (4)
      - - - - - Do-hickey (5)
      - - - - - Ultra Dingle (6)
      - - - - Do-dads [8]

      and setting homeId=2 resulted in the following rendering on page 4:

      Products > English > Products > Widgets >Thing-a-ma-bob

      Adding the following to the snippet on line 322 fixes the problem
          // Reset parent
          $parent = $tempCrumb['parent'];
      >    if ($parent == $homeId) {
      >        break;
      >    }
      
          // Increment loop safety
          $loopSafety++;



        • 13577
        • 302 Posts
        Home link parameters (all of them) act somewhat independently of the rest of the breadcrumb trail. So the behavior you describe is not un-expected. The reason the home link has its own set of parameters is so that you can include a link that isn’t ordinarily in the trail.

        A review of the post showing the sample hierarchy shows:

        - Home (1)
        - English (7)
        - - Products (2)
        - - - Widgets (3)
        - - - - Thing-a-ma-bob (4)
        - - - - Do-hickey (5)
        - - - - Ultra Dingle (6)
        - - - Do-dads [8]
        - - Services (9)
        - - Contact (10)
        - Pig Latin (11)
        - - Oductspay (12)
        - - - Idgetsway (13)
        - - Ervicessay (14)
        - - Ontactscay (15)
        - Random page (16)

        Note that "Home" is not in the same place as in your sample structure. If you want a page to show up in the breadcrumbs that isn’t really in the hierarchy, then you use the home crumb. Otherwise just leave it off (showHomeCrumb = 0).

        Setting your homeId to some page in the middle of the structure is not something I would recommend.
          Standard Disclaimer
          I could be totally wrong.
          • 23703
          • 180 Posts
          The change of your example was on purpose and made to make it identical to my test case. To lazy to write my own... smiley

          Anyway - if someone, for whatever reason, wants to set the homeId to another page than the top page in the hierarchy, isn’t the expected behaviour from the snippet that the trail will begin from that page and trickle downwards? Not to jump up one level and then jump back to the specified page. Setting showHomeCrumb = 0 doesn’t help since the snippet still jumps up one level and the back down. The fix corrects this with (to my knowledge) no ill effects.
            • 13577
            • 302 Posts
            Quote from: Pont at May 21, 2008, 01:35 PM

            The change of your example was on purpose and made to make it identical to my test case. To lazy to write my own... smiley
            Ah okay. You said it was from my example and I just wanted to be clear on how this thing operates.

            Quote from: Pont
            ...isn’t the expected behavior from the snippet that the trail will begin from that [specified home page] page and trickle downwards?
            No. This snippet is generated from the current page upwards. The "home crumb" is literally just a wild card to append on the front of the trail. Nothing more, nothing less. It is really intended for situations when you want a home crumb that is not in the hierarchy. I really can’t emphasize that enough. If the page you want to stop on is already in the hierarchy, you have no need of the so called "home crumb."

            Quote from: Pont
            ...Setting showHomeCrumb = 0 doesn’t help since the snippet still jumps up one level and the back down. The fix corrects this with (to my knowledge) no ill effects.
            Well... setting it to 0 will turn it off completely, so no, it won’t jump back down. At least it shouldn’t. If it does then it’s a bug I need to work out. Is there harm with your suggested remedy? In this scenario probably not, but since you can accomplish your goal without it, I’d be reluctant to race to implementation without considering how it short circuits the methodology. I just haven’t thought a lot about it honestly. It may be perfectly fine.

            So from your example where your structure is (and I’ll add on the pig latin language for further explanation):

            - Home (1)
            - - English (7)
            - - - Products (2)
            - - - - Widgets (3)
            - - - - - Thing-a-ma-bob (4)
            - - - - - Do-hickey (5)
            - - - - - Ultra Dingle (6)
            - - - - Do-dads [8]
            - - Pig Latin (9)
            - - - Roductspay (10)
            - - - - Idgetsway (11)

            And your desired trail is (on pg 4):

            Products > Widgets >Thing-a-ma-bob

            Instead of setting Products as the home page, just set your products page (or pages if using multiple languages) to be a stop ID:
            [[ ... &stopIds=`2`]]


            If you want that consistency across the products page in both languages, then you just set all the language pages as stop ID’s:
            [[ ... &stopIds=`2,10`]]


            Or even better, if your structure isn’t always going to branch off of products, but the languages themselves - consider this enhanced structure:

            - Home (1)
            - English (7)
            - - Products (2)
            - - - Widgets (3)
            - - - - Thing-a-ma-bob (4)
            - - - - Do-hickey (5)
            - - - - Ultra Dingle (6)
            - - - Do-dads [8]
            - - Services (9)
            - - - Knowledge Base (16)
            - - - FAQ (17)
            - - Contact (10)
            - Pig Latin (11)
            - - Oductspay (12)
            - - - Idgetsway (13)
            - - Ervicessay (14)
            - - Ontactscay (15)
            - Random page (16)

            Then you can declare the languages the stopIds (roots of each section so to speak):
            [[ ... &stopIds=`7,11`]]


            So on the FAQ page (17) you’d get:
            English > Services > FAQ

            If you don’t want English (7) to show, as you probably wouldn’t, then either unpublish it, OR declare it in ignoreIds:
            [[ ... &ignoreIds=`7,11`]]


            Which will show on pages 4 and 16 respectively:
            Products > Widgets > Thing-a-ma-bob
            Services > FAQ


            So I hope that helps clarify what this thing does, and what the parameters are used for. If it’s not clear, please ask. Meanwhile I’ll also consider your fix to see if it would have unintended consequences in other scenarios.
              Standard Disclaimer
              I could be totally wrong.
              • 23703
              • 180 Posts
              Ahh, I get it. Thank you for your thorough explanation and sorry for the trouble.
                • 13577
                • 302 Posts
                No trouble at all. Anything that clarifies functionality is worth it to me. Thanks for your input - your code bit still intrigues me... I just don’t want to be hasty to add something that will further complicate understanding how Breadcrumbs works.
                  Standard Disclaimer
                  I could be totally wrong.
                  • 30596
                  • 19 Posts
                  Okay, got a question. I got the breadcrumbs installed that wasn’t too hard. I read through every single post on this thread and didn’t see a solution so figured I’d post here. Please keep in mind I am not a programmer and could really use the help.

                  We are not planning to use ModX for our site’s index page, just for our articles and content. I installed ModX in it’s own directory not in the root directory. However, with the breadcrumbs I would like the home link to link to our site’s index page in the root directory which is not a page on ModX. I looked at the breadcrumbs code and got totally lost on where I could change it so it would like the home page to a static url instead of a page within ModX. Can anyone help me? I would really appreciate it.
                    • 30596
                    • 19 Posts
                    Quote from: tres6 at May 21, 2008, 08:39 PM

                    Okay, got a question. I got the breadcrumbs installed that wasn’t too hard. I read through every single post on this thread and didn’t see a solution so figured I’d post here. Please keep in mind I am not a programmer and could really use the help.

                    We are not planning to use ModX for our site’s index page, just for our articles and content. I installed ModX in it’s own directory not in the root directory. However, with the breadcrumbs I would like the home link to link to our site’s index page in the root directory which is not a page on ModX. I looked at the breadcrumbs code and got totally lost on where I could change it so it would like the home page to a static url instead of a page within ModX. Can anyone help me? I would really appreciate it.

                    Okay, answered my own question. First off I didn’t have the newest version installed so I did that and then I just turned the showHomeCrumb to 0 and added a link in my template to my index page. Duh? I should have figured that out sooner.
                      • 13577
                      • 302 Posts
                      That works.

                      Another solution would be to create a web link in MODx pointing to your home page. It could be in an out of the way place (not in the browse-able hierarchy) and then set the home crumb to this link. The advantage to this technique would be all breadcrumb links would be handled by the Breadcrumbs snippet. This is of interest when considering styling because the first crumb will get the first_crumb class assigned to it. If you were to just add that crumb in your template, then the second crumb would have the class first_crumb - which may not matter to you, but then again it might. Or it might in the future.

                      Just a thought.
                        Standard Disclaimer
                        I could be totally wrong.