We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19554
    • 59 Posts
    In site I am currently developing, I am trying to produce breadcrumbs navigation using Wayfinder.
    Reasons not to use already existing Breadcrumbs snippet?
    1. Wayfinder is fully customizable - zillion of templates, no need to introduce/duplicate css clases, etc.
    2. My customer asks for breadcrumb navigation in title of each page. Existing Breadcrumbs snippet is not suitable for this, since there is no way to produce just text without links.

    Can anyone help me produce breadcrumb navigation with Wayfinder. Is it possible with latest version at all? If not possible, I think it would be great to extend Wayfinder to cover all and every navigational need that can occur on various sites.
    Maybe adding "showSiblings" parameter would be clean and nice solution that could further generalize this nice snippet.
    Thanx in advance!
      • 15987
      • 786 Posts
      I think this will work:

      for the template &outerTpl create a chunk like the following:

      <div id="breadCrumbs"[+wf.classes+]>
      	[+wf.wrapper+]
      </div>
      


      for the template &rowTpl create a chunk like this:

      <a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a> » [+wf.wrapper+]


      if you don’t want it to use links then try this:

      [+wf.linktext+] » [+wf.wrapper+]


      I have not tested this, so it may require some tweaking, but it should work.
        • 19554
        • 59 Posts
        Unfortunately, proposed solution does not work since result is not breadcrumb (i.e. straightforward reversed path from current node to ultimate parent), but "flattened" tree where all siblings are listed.
        I looked at Wayfinder source, and somewhere near beggining of code, "parent list" is fetched, but I do not know how to make Wayfinder not to expand this list... Any hints?
          • 15987
          • 786 Posts
          ok try this:

          instead of using the chunk for &rowTpl like I described create a chunk for it but leave it blank

          then for the template &activeParentRowTpl use:

          <a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a> » [+wf.wrapper+]


          and for the template &hereTpl use:

          <a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a>
            • 19554
            • 59 Posts
            kylej,

            thanx a lot, I solved my problem thanx to you. I posted "howto" entry on modx wiki with solution: http://wiki.modxcms.com/index.php/Breadcrumb_navigation_with_Wayfinder
              • 15987
              • 786 Posts
              Great, glad to hear you got it working.

              Thanks for adding it to the wiki also smiley
                • 19889
                • 616 Posts
                Quote from: kylej at Dec 14, 2006, 12:40 AM

                Great, glad to hear you got it working.

                Thanks for adding it to the wiki also smiley

                Hello,

                I got it working too somewhat - the code that is produced is this:

                
                          
                	 
                 
                 
                <a href="/sites/desert-dreams/index.php?id=13" title="Tiere" >Tiere</a> » 
                
                	<a href="/sites/desert-dreams/index.php?id=14" title="Pferde" >Pferde</a> » 
                
                	<a href="/sites/desert-dreams/index.php?id=179" title="test" >test</a>
                
                
                
                
                 
                 
                 
                
                
                
                
                 
                 
                 
                
                </div>
                


                I have no idea where this empty space is coming from - hope somebody can help. Moreover, if the rowTpl is just empty, it doesn’t work - I have to add a blank space to the rowTpl chunk in order to make it work.

                would be nice if we could get this working.

                thank you
                  • 2166
                  • 8 Posts
                  First of all, thank you for your sharing.

                  I had a pb having it to work properly but here is what I had to do : putting a space in the BreadCrumbRow chunck.

                  When using empty chunk I had all the element after current doc displayed.

                  By just adding a space in this BreadCrumbRow chunk instead of having it empty solved it.

                  Just to share...