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.

What is wrong with my breadcrumbs?

June 11, 2012 12:51pm

Subscribe [3]
  • #1 / Jun 11, 2012 12:51pm

    vw000

    482 posts

    Hi, Im using the code example posted here:
    http://www.fatfreeinteractive.com/blog/post-title/create-breadcrumb-navigation-in-expression-engine

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

    I have the channels created and this seems only to work for segment 1 of the url.

    If I go to:
    example.com/segment1/

    The breadcrumb code works.

    If I go to:
    example.com/segment1/segment2/

    It only shows a link to the homepage.

    What is wrong with that code?

  • #2 / Jun 11, 2012 1:15pm

    Rob Allen

    3114 posts

    Try adding dynamic=“no”...

    {exp:channel:entries channel="{segment_1}" limit="1" dynamic="no"}
  • #3 / Jun 11, 2012 1:42pm

    vw000

    482 posts

    dynamic=no does not seem to make any difference.

    It seems its not working for segment2 at all, only for segment1.

  • #4 / Jun 11, 2012 1:56pm

    Rob Allen

    3114 posts

    What path are you using for single entry pages? /channel_name/entry_url_title or /channel_name/something/entry_url_title

  • #5 / Jun 11, 2012 2:15pm

    vw000

    482 posts

    I create template group:

    /test/

    It has the default index.php

    Inside there is another template
    template2

    Which would be:
    example.com/test/template2/


    I created both channels, “test” and “template2”

    It works on “test” not on “template2” which would be segment2.

  • #6 / Jun 11, 2012 2:27pm

    Rob Allen

    3114 posts

    So you are using 2 separate channels? That could get complicated but try something like this…

    {if segment_2 == ""}
    
      {exp:channel:entries channel="{segment_1}" limit="1"}
      <a href="http://{path={segment_1}}">{channel}</a> » 
      {/exp:channel:entries}
    
    {/if}
    
    {if segment_2 != ""}
    
      {exp:channel:entries channel="{segment_2}" limit="1"}
      <a href="http://{path={segment_1}/{segment_2}}">{channel}</a> » 
      {/exp:channel:entries}
    
      {if segment_3 != ""}
      {exp:channel:entries channel="{segment_2}" limit="1"}
      <a href="http://{path={segment_1}/{segment_2}}">{title}</a> » 
      {/exp:channel:entries}
      {/if}
    
    {/if}
  • #7 / Jun 11, 2012 2:51pm

    vw000

    482 posts

    But what does the tutorial then refers to if not a different channels?

    Let me mention that I don´t use channels for content at all, I would just create this in order for the breacumbds to work, so they are automatically generated as I create pages, but seeing how complicate something so simple like this is I may jump back to just manually editing each file in Dreamweaver. I was under the impression that EE could generate some things automatically and save me from manually doing this, but it does not seem the case. If I have to manually start creating things what is the difference vs doing it manually like actually opening the file and editing the breadcrumb.

  • #8 / Jun 11, 2012 3:03pm

    Rob Allen

    3114 posts

    The tutorial assumes you are using one Channel, not two. If you use a single channel then it fairly straightforward to create dynamic breadcrumb navigation using the tutorial 😊

  • #9 / Jun 11, 2012 3:07pm

    vw000

    482 posts

    Ok, lets say I only create one channel then, the code is taking the channel name, so how in the world would it display the other pages/templates names if there is only is 1 channel name?

    I imagined I need to create 1 channel for each template with its corresponding name, shorname being exactly the same as the template name.

    All I want is the most easiest way to generate/copy templates and that EE will dynamically or automatically fill in the breadcrumb navigation without having to do it manually.

  • #10 / Jun 13, 2012 1:21pm

    meredith1986

    2 posts

    I am also having problems using that same tutorial except my page doesn’t display anything at all.

    I created a channel and called it Contact (I didn’t change any other preferences). Then I created a Template Group called contact and put the code from the tutorial on the index template (along with the rest of my contact page code).

    I feel like something is missing, but I don’t know what since I just started using EE a few days ago and I’m still learning. Any thoughts?

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

    vw000

    482 posts

    I never figured out how to make this work. One channel or not, this only shows up on Segment1 for my, once you browse one page deeper the breadcumbs only shows the homepage.

    If there any other way easier to do this?

    Like I don´t mind putting the page name into each page, just in order it will show up in the navigation.

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

ExpressionEngine News!

#eecms, #events, #releases