ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Can’t get breadcrumbs to work (beginner!)

June 13, 2012 4:53pm

Subscribe [4]
  • #1 / Jun 13, 2012 4:53pm

    meredith1986

    2 posts

    I’m super new to EE so I don’t quote understand channels, templates, etc. yet, but I’m learning as I go. I’m trying to add breadcrumbs to all of my pages (I only have 2 pages right now, Home and Contact), but haven’t been able to have any luck. I followed this tutorial: http://www.fatfreeinteractive.com/blog/post-title/create-breadcrumb-navigation-in-expression-engine.

    As the tutorial says to do, I created a channel called “contact” and a template group with the same name, “contact.” The index page within the “contact” template has my full page code on it, including this breadcrumb code:

    {exp:channel:entries channel="{segment_1}" limit="1"}
        <a href="http://{site_url}">Home Page</a> » 
        {if '{segment_3}' != ""}
        <a href="http://{path={segment_1}}">{channel}</a> » 
        {title}
        {if:elseif '{segment_2}' == ""}
        {channel}
        {/if}
        {/exp:channel:entries}

    The Contact page is only a second level page as I have no need for a drop down menu under Contact, but I still think it should end up showing “Home > Contact” and my page does not show anything at all.

    Can someone please advise? Thanks so much!

     

  • #2 / Jun 13, 2012 11:30pm

    vw000

    482 posts

    I followed that tutorial as well and sadly no one in this forums could help me out either.

    I did noticed that there seems to be an error in that code. It will show up the channel entry for the 3 third segment. If you want it show for segment 2 try this:

    {exp:channel:entries channel="{segment_1}" limit="1"}
        <a href="http://{site_url}">Home Page</a> » 
        {if '{segment_2}' != ""}
        <a href="http://{path={segment_1}}">{channel}</a> » 
        {title}
        {if:elseif '{segment_3}' == ""}
        {channel}
        {/if}
        {/exp:channel:entries}

    Now here comes the funny part, it always shows the last entry channel, in my case its not actually taking the channel entry based on the url name.

  • #3 / Jun 14, 2012 2:41pm

    Dan Decker

    7338 posts

    Hi meredith1986,


    Welcome to ExpressionEngine and the forums!

    I’m not familiar with the tutorial you reference, but Nibb’s rework of the code should be closer to what you are after.

    However, the overall effect is subjective you how you are setting up channels, template groups and templates.

    For a different approach, you can use Crumbee - it automates the process.

    Cheers,

  • #4 / Jun 14, 2012 2:47pm

    vw000

    482 posts

    I actually gave up with this setup and purchased Crumbly:
    http://devot-ee.com/add-ons/crumbly

    Its expensive, 45$ but it will save you headaches and problems in the future. It works out of the box.

    I searched in Google and doing breamcrumbs out of the box is not that easy and you will end up messing with allot of parameters, tags and functions. So yes plug in a module and its easier than messing around with the code.

    There are also free ones. I just went with this one in case I need something more advanced in the future.

  • #5 / Jun 14, 2012 3:12pm

    meredith1986

    2 posts

    I followed that tutorial as well and sadly no one in this forums could help me out either.

    I did noticed that there seems to be an error in that code. It will show up the channel entry for the 3 third segment. If you want it show for segment 2 try this:

    {exp:channel:entries channel="{segment_1}" limit="1"}
        <a href="http://{site_url}">Home Page</a> » 
        {if '{segment_2}' != ""}
        <a href="http://{path={segment_1}}">{channel}</a> » 
        {title}
        {if:elseif '{segment_3}' == ""}
        {channel}
        {/if}
        {/exp:channel:entries}

    Now here comes the funny part, it always shows the last entry channel, in my case its not actually taking the channel entry based on the url name.

    Thanks Nibb! After reading a tutorial about how to properly set up Channels, and by using your code, the breadcrumbs work on my second-level and third-level pages! I didn’t realize I had to not only create a new Channel, but I needed to create a new Channel Field Group and Channel Field as well.

    I have read about Crumbly as well, but I’d like to save my client money where I can since they’re already going to have to pay for EE.

  • #6 / Jun 14, 2012 3:20pm

    vw000

    482 posts

    That is correct, but in my case it was displaying the last entry channel for each page, not the correct entry based on the segment name, so you may need to check on that. I just got tired of playing with it. Yes, 45$ is expensive for something this small but there are also free ones that take the url name (segment) and capitalize the first letter and removes - or underscores in words, so it gets almost the same effect.

    But what ever works best for you and your design. My site just grows and can get very complicated in terms of to manage this, so it was best just go with a plugin.

  • #7 / Jun 18, 2012 12:03pm

    Dan Decker

    7338 posts

    Hey all,

    I’m glad to see you have found solutions that work!

    I’m going to move this over to Community Help to preserve the discussion.

    If you ever need anything else, please just let us know!

    Cheers,

  • #8 / Jun 25, 2012 7:11am

    Hello

    Now i think i understood this but my problem in my architecture

    I should name channels with the same name the template you want to join.

    And when i read the segments it seems it was maked like a tree , a directory hierarchy , with article’s id in the end

    What should i do in my situation ?

    By the way if i wanna give my segments new name , like insted of “xxx” i want smth lile “nature” , what could i do ? Because i’am sure the current names are already used in code of my website

  • #9 / Apr 22, 2014 2:23pm

    quinlan

    4 posts

    Hi Everyone,
    This is for anyone who is having trouble with breadcrumbs and did a search and found this thread.

    If you want a separator in between your entries like this:
    Home » Services » Government
    Where “home” and “services” are links but “government” is not use this code:

    {exp:crumbly:breadcrumbs}
            {if count < total_results}<a href="http://{breadcrumb_url}">{/if}_        {breadcrumb_title}_        {if count < total_results}</a>»{/if}
        {/exp:crumbly:breadcrumbs}

    It took me forever and trying several plugins and the tutorial mentioned above to figure this out. Silly me.

    Also I added this code to my header file, but to prevent my breadcrumb from showing up on the home page I added a IF statement around the above code so it now reads:

    {if segment_1 != ""}
       <div id="breadcrumb">
        {exp:crumbly:breadcrumbs}
            {if count < total_results}<a href="http://{breadcrumb_url}">{/if}_        {breadcrumb_title}_        {if count < total_results}</a>»{/if}
        {/exp:crumbly:breadcrumbs}
       </div>
       {/if}

    This allows me to use the breadcrumb code everywhere and not have to worry about it showing up on the home page 😊

    Cheers,
    Danny

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases