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.

breadcrumbs

October 02, 2007 8:27am

Subscribe [2]
  • #1 / Oct 02, 2007 8:27am

    nullbreached

    116 posts

    Isn’t there a way to easily put some breadcrumbs at the top of a page without having to use a plugin? I did some searching and really only found links to plugins.

    My example breadcrumb would be home > template Section > category name or blog title. But I think category name would be enough.

    Anything out there like that?

  • #2 / Oct 02, 2007 9:28am

    Boyink!

    5011 posts

    You can build them yourself just using a combination of whatever tags will return the right link.

  • #3 / Oct 02, 2007 9:46am

    nullbreached

    116 posts

    OK, I guess I’ll have to try and figure that out. 😊 thanks

  • #4 / Oct 02, 2007 12:42pm

    nullbreached

    116 posts

    OK, I found some code in the forums and maybe I a shooting myself in the foot with this, and I might already have figured it out…. I guess I’m looking for any opinions with what I’ve done.

    I built this breadcrumb link:

    <ul id="crumbs">
            <li><a href="http://{path=" title="Home">Home</a>/</li> {if segment_1 <> NULL}<li><a href="http://{path=" title="{segment_1}">{/if} {segment_1}</a>/</li>{if segment_2 <> NULL}<li><a href="http://{path=" title="{segment_2}">{/if} {segment_2}</a>/</li>
            </ul>

    The trouble is that “segment one” is my template group. I thought by changing my site to that template group being the homepage that it would come off the breadcrumb, but it doesn’t… Should I just remove “segment one” from my code.. or is there a better way?

  • #5 / Oct 02, 2007 1:06pm

    nullbreached

    116 posts

    This seemed to do the trick. Kinda of crude, but ti works.

    <ul id="crumbs">
            <li><a href="http://{path=" title="home">home</a>/</li> {if segment_2 <> NULL}<li><a href="http://{path=" title="{segment_2}">{segment_2}</a>/</li>{/if}  {if segment_3 <> NULL}<li><a href="http://{path=" title="{segment_3}">{segment_3}</a></li>{/if} 
            </ul>
  • #6 / Oct 28, 2007 4:55pm

    nullbreached

    116 posts

    Back again…

    The crumbs aren’t working very well since I have to have super easy descriptive segments in order for it to really work:

    <ul id="breadcrumbs">
            <li><a href="http://{path=" title="home">home</a>/</li> {if segment_2 <> NULL}<li><a href="http://{path=" title="{segment_2}">{segment_2}</a>/</li>{/if}  {if segment_3 <> NULL}<li><a href="http://{path=" title="{segment_3}">{segement 3}</a></li>{/if} 
            </ul>

    The problem with all this is segments sometimes are just the template that I am on and in segment three if I am on a gallery detail the underscore is added in my crumb?

    How can I get it so the titles of the gallery item I am view show up and without underscores? or ignore templates?

    Has anyone created some breadcrumbs scripts not just for pages?

  • #7 / Oct 28, 2007 6:57pm

    allgood2

    427 posts

    Building breadcrumbs can be a fairly independent practice—meaning what works for one, won’t work for everyone else.  For example, here’s breadcrumb code I used for a recent client site:

    <div class="breadcrumbs">
        <small>
        <a href="http://www.site.org" title="My Web Site">Home</a>
        
        {if segment_1 !=""}  ›  <a href="/{segment_1}/" title="{segment_1}">{exp:php_text_format type="ucwords"}{segment_1}{/exp:php_text_format}</a>{/if}
        
        {if segment_2 !="" AND segment_2 !="article"}  ›  <a href="/{segment_1}/{segment_2}/">{exp:weblog:category_heading}{exp:php_text_format type="ucwords"}{category_name}{/exp:php_text_format}{/exp:weblog:category_heading}</a>{/if}
        
        {if segment_2 =="article"}  ›  {exp:weblog:entries weblog="about|blog|digital|tech|mobile|workshops|resources|projects" limit="1" status="not Closed" disable="trackbacks"}{title}{/exp:weblog:entries}{/if}
    
            {if segment_3 =="article"}   ›  {exp:weblog:entries weblog="about|blog|digital|tech|mobile|workshops|resources|projects" limit="1" status="not Closed" disable="trackbacks"}{title}{/exp:weblog:entries}{/if}
        
        </small>
        </div>

    I’ve added spacing so that the various if statements are more distinguishable. But as you can see, the statements generally take into consideration how you’ve set-up the site navigation and url structure in the first place.  For this client, segment_1 was always the section that they were in, and sections matched weblogs and template_groups simultaneously. Since the segments were simple, I just used the {segment_1} code, but if they had been more complicated (example: products == Product Catalog, then I could have used the weblog name (not short name) instead of {segment_1}.

    This was a custom url project for a client, so the second segment was typically a category_id. So obviously a query to return the category name, and not the id. Etc., etc. 

    But, this is just one example, I find that reusing breadcrumb code is about bits and pieces, there has only been a few times when I been able to just paste in the code from one site to the next.

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

ExpressionEngine News!

#eecms, #events, #releases