Welcome Guest, Not a member yet? Register   Sign In
DTE BreadCrumb Class
#31

[eluser]ericsodt[/eluser]
[quote author="Bazze" date="1283824140"]Hmm.. works great as long as you click your way thru on the site, but if you for example click a link which leads to a page which should be 'Home > Sub level 1 > Sub level 2 > Sub level 3' it just becomes Sub level 3.[/quote]

I am not quite sure what you mean by your comment, can you please expand


The point of breadcrumbs is to be able to follow 'your trail' through the site. Your job, as the programmer, is to create that trail by adding "crumbs" to the stack.
Code:
// setup breadcrumb
        $bc = array(
               'title' => 'Home',
               'url' => 'home',
               'isRoot' => true
        );        
        $this->breadcrumb->setBreadCrumb($bc);
        
        // pass data onto the views
        $data = array(
               'title' => 'my name',
               'content' => 'home',
               'breadcrumbs'=>get_Instance()->breadcrumblist->display()
        );
        $this->load->view('siteLayout',$data);

If you get to the "update person" page by going through a link then the crumb should be: "Home > Update Person". If you get to the "update person" page by clicking around through the "organization" page and the "content" page, then the bread crumb will be:
"Home > Organization > Content > Update Person". A bread crumb is created to be able to follow the way in which you got to your current destination...
#32

[eluser]Bazze[/eluser]
Oh. I thought this was to show where you are on the site according to the hierarchical site structure. I mean that it show the parent pages of the current one. That is what I call breadcrumbs. I guess I'll just have to create my own breadcrumb library Smile
#33

[eluser]ericsodt[/eluser]
[quote author="Bazze" date="1283829807"]Oh. I thought this was to show where you are on the site according to the hierarchical site structure. I mean that it show the parent pages of the current one. That is what I call breadcrumbs. I guess I'll just have to create my own breadcrumb library Smile[/quote]

We are both correct; breadcrumbs *can* be hierarchical but in order to create that hierarchy, the programmer would need to know the layout of the site in which it is implemented. If my library does not serve your needs there are plenty of others out there, one of them might be able to. Good luck with your library
#34

[eluser]rubberglover[/eluser]
Brilliant library, worked like a charm for me... I'm using it on dynamic URLs, and it took me a few minutes to realise I could use it in this way so if anyone else is having this problem, here's how to do it.

Say you've created a blog and you browse to a category, then to a post, your URL trail might be like so (assuming your controller is called 'blog'):

/blog/categories > /blog/view_category/3 > /blog/view_post/16

You can get a breadcrumb trail including the function parameters by using the CI uri_string() function each time you specify the breadcrumb settings in you controller functions:

Code:
//create breadcrumbs
$bc = array(
   'title' => 'My page title',
   'url' => uri_string(),
   'isRoot' => false
);
$this->breadcrumb->setBreadCrumb($bc);
$data['breadcrumbs'] = get_Instance()->breadcrumblist->display();

Obvious really but thought I'd share just in case anyone else was scratching their head :-)
#35

[eluser]ShadowMage[/eluser]
Sorry for bringing up an old topic but I had a question.

Is there a way for a parent attribute for the breadcrumbs so I don't end up with:

Home >> News >> Account Activation

but instead have it be

Home >> Users >> Account Activation
#36

[eluser]ericsodt[/eluser]
[quote author="ShadowMage" date="1308442708"]Sorry for bringing up an old topic but I had a question.

Is there a way for a parent attribute for the breadcrumbs so I don't end up with:

Home >> News >> Account Activation

but instead have it be

Home >> Users >> Account Activation[/quote]

You're in total control of the breadcrumbs. In your action class, instead of using "News", use "Users".




Theme © iAndrew 2016 - Forum software by © MyBB