Exclude root folder from Breadcrumbs

zepedac's Avatar

zepedac

02 Jul, 2015 07:49 PM

How do I exclude the root folder "/" from showing up on the breadcrumbs velocity format?

  1. 1 Posted by zepedac on 02 Jul, 2015 07:52 PM

    zepedac's Avatar

    Here is the .txt version of the format.

  2. 2 Posted by Ryan Griffith on 02 Jul, 2015 07:58 PM

    Ryan Griffith's Avatar

    Hi,

    Perhaps you can surround the contents of the #foreach with an #if statement that checks to make sure the current crumb's path is not /. Something like the following:

    #foreach ($crumb in $trail)
      #if ($crumb.getChild("path").value != '/')
        ...
      #end
    #end
    

    Please let me know how this works out, or if you have any questions.

    Thanks!

  3. 3 Posted by zepedac on 02 Jul, 2015 08:22 PM

    zepedac's Avatar

    Hi Ryan,

    I've tried wrapping it right after the #foreach and no luck. Can't figure out why it isn't complying.

  4. 4 Posted by Ryan Griffith on 02 Jul, 2015 08:25 PM

    Ryan Griffith's Avatar

    Thank you for following up. Perhaps try outputting the value of $crumb.getChild("path").value just to check and see what the path value is for the root folder. I believe it should be /, but could be wrong.

    Thanks!

  5. 5 Posted by zepedac on 02 Jul, 2015 08:32 PM

    zepedac's Avatar

    Ryan,

    In my case it output // rather than /. Strange, but that worked on the conditional statement you provided.

    Thank you for your help!

  6. 6 Posted by Ryan Griffith on 06 Jul, 2015 11:55 AM

    Ryan Griffith's Avatar

    Ah, thank you for testing, and I am glad to hear you were able to get things working. I have seen that as well for the root folder, so I would go with that conditional for the time being.

    I'm going to go ahead and close this discussion, please feel free to comment or reply to re-open if you have any additional questions.

    Have a great day!

  7. Ryan Griffith closed this discussion on 06 Jul, 2015 11:55 AM.

Discussions are closed to public comments.
If you need help with Cascade CMS please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

 

26 Aug, 2016 01:19 PM
25 Aug, 2016 03:02 PM
25 Aug, 2016 12:50 PM
24 Aug, 2016 08:43 PM
24 Aug, 2016 07:20 PM
21 Aug, 2016 01:20 PM