Breadcrumbs

edited March 2014 in Modules
I'd like some help rendering my breadcrumbs trail.

In my main.php layout, I have
echo fuel_nav(array('group_id'=>'main','render_type'=>'breadcrumb','container_tag_class'=>'breadcrumb'));
My site has two types of views.

The first is standard pages created in Admin. I have added those to the Navigation section in Admin under the Navigation group "main". The breadcrumbs for these render correctly it seems.

The second type of page I have is not in Admin but created as controller->view code. eg. I have a "computers" controller whose index() function builds the page data and passes this off to my "computers_view" to display it within the "main" layout. I have a Navigation element in Admin called "computers" and is in the "main" Navigation group. This shows it's breadcrumb correctly.

However. In the "computers" controller I have another page to render so have a function called computer_models() which builds the page data and passes it to the "computer_models_view" - again, within the "main" layout. I have a Navigation element for this page as a child of the "computers" Navigation element. The breadcrumb on this page does not appear. I get "Home >" only. I was expecting to get "Home > Computers > Computer Models".

Can anyone explain what I'm missing? Am I misunderstanding how the breadcrumbs are created?

TIA

Comments

  • edited 11:06PM
    This usually happens when their is a break in the menu data's parent/child hierarchy. In other words, what are the navigation items being passed to fuel_nav? Based on what you've stated, it seems like you may need to append some items to fuel_nav because you are probably dynamically creating the computer_models pages correct? You could try something like the following (note that I'm making some assumptions about model and slug variable names):
    ... $model = $this-> computer_models_model->find_one(array('slug' => $slug)); $append['computers/models/'.$slug] = array('label' => $model->name, 'parent_id' => 'computers/models'); echo fuel_nav(array('append' => $append, 'group_id'=>'main','render_type'=>'breadcrumb','container_tag_class'=>'breadcrumb'));
Sign In or Register to comment.