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.

[SOLVED] Breadcrumb with Current Category

June 27, 2008 5:00pm

Subscribe [2]
  • #1 / Jun 27, 2008 5:00pm

    sparkle

    13 posts

    I’ve been struggling with this for a few hours now, and I’m sure it’s easy as pie, but I need help:

    I have a weblog called recipes here:
    http://www.hutchinsonscorner.com/recipes/

    and I have the following code for my breadcrumb:

    You're viewing [url={path=recipes/index}]Recipes[/url] | {categories}[url={path=recipes/index}]{category_name}[/url] | {/categories} {title}


    The path works fine when I’m on the main recipes page, and when I’m viewing a full article, like this:
    http://www.hutchinsonscorner.com/recipes/view/old-fashioned-granola/

    However, if you click on the category to view only recipes in that category, it only shows ‘Recipes’ and not ‘Recipes | Breakfast’ (for example)

    Can anyone see where I’ve gone wrong?

    Thanks in advance!
    LAURA 😊

  • #2 / Jun 27, 2008 5:07pm

    sparkle

    13 posts

    Sorry I couldn’t figure out how to correctly insert my proper code with a href’s - hopefully it makes sense!

  • #3 / Jun 27, 2008 8:06pm

    lebisol

    2234 posts

    Hey Laura,
    Look through this post.
    There is no out-of-box display of /parent_cat/child_cat/entry_title ...in other words, yes only one category will be in url. This might be some food for thought when making choice on weblogs or categories. I have also benefited from this thread.
    Somewhere in between you should find what fits your design goals.
    All the best!

  • #4 / Jun 28, 2008 12:37am

    sparkle

    13 posts

    Thanks very much for your help -

    This was how I solved my issue:

    1. Download and installed the Find and Replace plugin

    2. Download and install the PHP Text Format plugin

    3. Insert the following code where I wanted the breadcrumb to display:

    <a >Home</a> ›
    {if segment_1 !=""}<a >{exp:php_text_format type="ucwords"}{segment_1}{/exp:php_text_format}</a> {/if}
    {if segment_2 =="category"}› <a >{exp:php_text_format type="ucwords"}{exp:replace replace="SPACE" find="_"}{segment_3}{/exp:replace}{/exp:php_text_format}</a> {/if}
    {if segment_2 =="view"}› {exp:weblog:entries weblog="recipes" limit="1" disable="trackbacks"}{title}{/exp:weblog:entries}{/if}
    {exp:php_text_format}
    

    * I can’t figure out here how to post the code with links intact - so above you will have to include “/{segment_1}” title=”{segment_1}” and “/{segment_3}” title=”{segment_3}” where there are empty <a > tags

    You will have to change the “view” and “category” to your own templates, but you can probably expand this if you have more levels.

    Hope this helps someone -

    Thanks again

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

ExpressionEngine News!

#eecms, #events, #releases