We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13577
    • 302 Posts
    Snippet: Breadcrumbs
    Version: 0.9c
    Description:
    This snippet was designed to show the path through the various levels of site structure back to the root. It is NOT necessarily the path the user took to arrive at a given page. Based on PageTrail snippet by: Bill Wilson.

    You can download the code below. I’m also posting the changelog just incase anyone is interested.
      Standard Disclaimer
      I could be totally wrong.
      • 32241
      • 1,495 Posts
      Nice one Jaredc,

      here is a little modification from me, to allow defining parameters on the snippet calling. I also add 2 more snippet parameters for user to define the title and description field to be used. If none specified, it will defaulted to pagetitle.

      I haven’t tested this yet, so jaredc, feel free to change and modify it accordingly.

      Sincerely,
        Wendy Novianto
        [font=Verdana]PT DJAMOER Technology Media
        [font=Verdana]Xituz Media
        • 13577
        • 302 Posts
        Hm... makes the config section a little more cluttered than I am used to, but extends the capability of the snippet. To me, this seems like one of those snippets that you like to have be consistent throughout the site, so individualized instances with different parameters are probably not going to be used very often. Still, it doesn’t seem to hurt things so I don’t see why not.

        As far as allowing the developer to to specify which field to use as the the title and description, I suppose that’s okay too. Though setting the default in the config section to "pagetitle" for both the $titleField and $decField doesn’t make much sense to me since the title and description will default to "pagetitle" if the desired field doesn’t exist regardless. I think I’ll change those to menutitle and description respectively. I think this will give the best "out of the box" behavior for most users. Those who want can change it.

        Thanks for the input. I’ll get a 0.9b out soon. Do any PHP zealots out there know if adding a bunch of isset() variable checks will do much damage on speed? Doesn’t seem like it to me, but I thought I’d ask.
          Standard Disclaimer
          I could be totally wrong.
          • 32241
          • 1,495 Posts
          There is always is a performanceissue, but a note to add, it might only affect 0.0000000000000000000001 second. Believe me, it won’t suffer from performance issue, considering all the speed of computer right now; instead it will give more greater usability. wink
            Wendy Novianto
            [font=Verdana]PT DJAMOER Technology Media
            [font=Verdana]Xituz Media
            • 13577
            • 302 Posts
            Quote from: Djamoer at Feb 24, 2006, 03:22 PM
            ...it won’t suffer from performance issue...

            Yeah. I didn’t think so. But I thought I’d ask. If I ask "stupid" questions long enough, eventually I’ll run out of them and that will have to mean I’m smart... right? laugh

            Anyway, the 0.9b version is now attached at the top of the forum.
              Standard Disclaimer
              I could be totally wrong.
              • 32241
              • 1,495 Posts
              Hey jaredc, it’s not like a stupid questions ya know, it’s more to intellectual questions. Some people might don’t care about it at all, and later they realize it’s a crucial things. grin
                Wendy Novianto
                [font=Verdana]PT DJAMOER Technology Media
                [font=Verdana]Xituz Media
                • 32241
                • 1,495 Posts
                Added to repository
                  Wendy Novianto
                  [font=Verdana]PT DJAMOER Technology Media
                  [font=Verdana]Xituz Media
                  • 3164
                  • 4 Posts
                  hi there, I had a problem using the breadcrumb snippet.
                  I don’t know if it is due to my special configuration, but I wanted to share it with you:

                  the parameters I defined as false ( as in showCrumbsAtHome=false ) didn_t work, because in the snippet the variable is treated as an boolean, but it actually is a string "false" and thus if ("false") evaluates as true.

                  After the Line
                  if(!isset($showCrumbsAtHome)) $showCrumbsAtHome = true;
                  I added a line
                  else if($showCrumbsAtHome== "false") $showCrumbsAtHome= false;

                  for all boolean parameters, and now it works great for me.
                    • 8461
                    • 205 Posts
                    Thanks Jaredc and Wendy

                    Just what I needed, great timing and works perfectly for me grin
                      • 32241
                      • 1,495 Posts
                      Quote from: bernd at Mar 03, 2006, 07:57 PM

                      hi there, I had a problem using the breadcrumb snippet.
                      I don’t know if it is due to my special configuration, but I wanted to share it with you:

                      the parameters I defined as false ( as in showCrumbsAtHome=false ) didn_t work, because in the snippet the variable is treated as an boolean, but it actually is a string "false" and thus if ("false") evaluates as true.

                      After the Line
                      if(!isset($showCrumbsAtHome)) $showCrumbsAtHome = true;
                      I added a line
                      else if($showCrumbsAtHome== "false") $showCrumbsAtHome= false;

                      for all boolean parameters, and now it works great for me.

                      Nice catch bernd, it’s my bad, it’s not jaredc fault. I forgot that every vars is treated as string on snippet calling.
                        Wendy Novianto
                        [font=Verdana]PT DJAMOER Technology Media
                        [font=Verdana]Xituz Media