To generate correct breadcrumbs down to the final node (breadcrumb: Home > Container > Category), the category_module actually generates a menu item for each node. In order to obtain this, the "Create menu items for assigned node (breadcrumbs only)" option needs to be enabled, otherwise breadcrumbs break at node level (breadcrumb: Home).
PROBLEM:
This approach is good for small category hierarchies, but on sites with a reasonably big number of nodes (400+) this behaviour leads to serious performance issues (pages fail to load), and to the impossibility to manage the admin/menu page because far too many items are stored there.
An alternative and more efficient solution for breadcrumbs generation in terms of management (storing "breadcrumbs only" in a place different from the standard navigation menus?), and handling by the system (performance) seems desirable.
Unfortunately no coder here, but i am definitely willing to contribute to a bounty to see this issue fixed!
thx
| Comment | File | Size | Author |
|---|---|---|---|
| #38 | category_breadcrumb.module.txt | 6.45 KB | JirkaRybka |
| #37 | category_breadcrumb.tar_.gz | 2.03 KB | JirkaRybka |
| #28 | category_breadcrumb_5.txt | 2.39 KB | marcoBauli |
| #25 | category_breadcrumb.info | 213 bytes | Permanently Undecided |
| #24 | category_breadcrumb_4.module | 2.32 KB | Permanently Undecided |
Comments
Comment #1
venkat-rk commentedThis seems to be true. I am working on a site that will have about 10-15k categories in the long run and I think this issue will create a serious problem on that site.
KarenS also has some thoughts about this:
http://drupal.org/node/73830#comment-118099
http://drupal.org/node/73830#comment-118113
Comment #2
nicholasthompsonThe actual issue - as I have found - is not category itself. Its kind of core.
See, to get breadcrumbs down to node level you need menu's to represent those paths (as you know). Also you've found that having that many menu's can kill drupal.
What happens is Drupal detects a change in the menu cache and tries to regenerate it. Once done, all is fine. Thing is - when you approach a few hundred cat's, it takes ages (10, 20 and possibly over 60 second) to regenerate the cache. This also happens whenever you add a new node - the whole menu cache gets regenerated.
Whats wierd, thought, is this very site (drupal.org) can breadcrumb down to node level without dying whenever a node is made. I can probably garuntee they dont use the Category module though :-)
Comment #3
karens commentedTaxonomy_menu does it without creating menu items, so there must be a way to do it...
Comment #4
marcoBauli commentedAnother module worth to look at for an eventual solution to this issue is Taxonomy_breadcrumb.
@Jaza: is this issue something you consider kind of priority on your Category To-do list? I definitely consider this bug critical and am interested in hiring someone to fix in case you are not going to put work on the Category module for some time..
@everyone: is there anybody else willing to contribute in a bounty to see this fixed? ..or is just me? If yes, please let me know throug my contact form or down here ;)
Comment #5
venkat-rk commentedkiteatlas, I have been considering offering some kind of a bug bounty to Jaza for clearing up the long issue list for category_menu issues. What do you think about this? Is anyone else interested in contributing to this?
The issue list seems to suggest that lots and lots of people are trying out the module and generally liking it better than the taxonomy module. Jaza has done an incredible amount of coding for category module and it would be a shame if time or lack of support from users or other factors prevented its progression into a potential replacement for core taxonomy.
Meanwhile, I am hoping he will look into the category_pathauto and category_bulkedit modules, both of which are unfortunately quite broken and unusable.
Comment #6
venkat-rk commentedClarification of previous post- the intent of the proposed bounty is to fix bugs and not to evangelize category as a replacement for taxonomy:-)
Comment #7
marcoBauli commented@ramdak: i've been looking around the forums to find some light on the breadcrumbs issue, but i noticed you preceeded me on almost all the pregnant topics ;) so i guess if you are sticking with the Category module also for breadcrumbs generation there must be a reason..
Actually breadcrumbs behave well for Containers and Categories, but that issue with the final nodes is a big black hole that completely breaks the orientation and navigation of a site! (users simply cannot understand where they are, neither can navigate back to the Category or Container they came from, unless starting from primary navigation again! Too bad!) This because when the breadcrumb breaks, you loose also the secondary navigation.
Also, another related issue is that the main containers (menu items) on primary navigation remain "active" ( bold or highlighted) only when you actually are browsing *that* container page, but as soon as you move to one of it's sub categories you loose the "active" status...
Ramdak, i am definitely willing to add a bounty for this to be solved as hopefully will do other Category aficionados! but another problem is to find a developer who can dedicate to this in a timely manner since Jaza seems pretty busy at the moment..
so the first step might be find some Category/Taxonomy expert Drupal coder to give a quote about solving this. Then try to involve as many interested people as possible to share expenses.
I have couple of names even if i never directly worked with them...if you have someone in mind that would be a good starting point i guess.
Please let me know what you think about this (feel free to contact me via contact-form),
cheers
Comment #8
radev commentedSome time ago I wished to create category_breadcrumb.module, which generates bredcrumbs for nodes in category structure without using menu items. But because lack of spare time I postponed this.
There is to approaches to solving this problem:
1) Simply generate breadcrumb on each page request, setting it with drupal_set_breadcrumb().
2) Use some kind of cache as for menu items. But this may be an early "over-optimization".
Is there need for such module in short time?
Comment #9
venkat-rk commented@kiteatlas: Thanks for the time you spent on working through the issue queue for menu module. I think about 80% (okay, it's an arbitrary number, but probably pretty close;-)) of category_menu issues. At the moment, I am not very comfortable about asking some other developer to do this. Let's wait until Jaza finishes his SoC project.
@radev: It would be great if you could whip up a quick patch on the lines you suggested as that would help Jaza make a decision quickly.
Comment #10
radev commentedSorry, I mean that additional module will display breadcrumbs, NOT patched category_menu module.
In attachment there is first test version of my category_breadcrumbs.module.
For this moment there is no settings on container page (settings like 'set breadcrumbs for categories' and 'set breadcrumbs for assigned nodes' will be provided in future version).
To use this module - simply place it into subdirectory within category module (like 'modules/category/category_breadcrumb') and enable in adminster/modules.
Breadcrumbs will be generated for nodes with assigned categories.
Comment #11
venkat-rk commentedThanks, radev. I think this will be an useful starting point.
Comment #12
marcoBauli commentedRadev, thanks for stepping up on this issue.
I tryed the mod, but breadcrumbs still break at node level for me.
Also:
. parent/child relationships are not reflected (es: if a root container 'b' is set as a child of another root container 'a', when i browse to 'b' i do not get home>a>b, but only home>b)
. hidden containers are not respected, and are shown even if they shouldn't.
Thank you
Comment #13
JonathanDStopchick commentedHeya all, if you're all interested, I've tweaked the module to show full paths, as it didn't work for me. Also it is now compatible with hidden containers.(they wont show in the breadcrumb)
It definetly needs testing, but I'll upload if I get more bugs. Lemme know if this is useful for ya. :)
Comment #14
marcoBauli commentedJonathan, does not work properly for me:
with your version "hidden" containers are not shown, but instead of it the actual category i am browsing to is shown as a clickable link (IMHO this is not right from a user point of view, since there is no need to navigate to the page where you actually are).
Also the full hierarchy is not yet reflected (same issue as with previous version above!)
My structure is:
Home
--Country
-----(Hidden container)
-------State
but when i am browsing the 'State' category my breadcrumb looks like:
Home >> State
instead of
Home >> Country (>> State)
Comment #15
bdragon commentedThis is only tested with my category_get_parents() bugfixes from
http://drupal.org/node/76921
I changed the "regular nodes" case to use category_location. This appears to work OK.
Comment #16
bdragon commentedOops! I accidentally left some debugging code in. Sorry about that.
Comment #17
marcoBauli commenteduhh...how might be that breadcrumbs show down to node level for authenticated users, but not for anonymous ones?!
also please don't get mad at me, but IMO from a UI point of view the final bit of the breadcrumb (the one referring to the node the user is currently viewing) shouldn't be clickable, because you are already viewing that page and this could be confusing for the user. Ideally it should be outputted as plain text, and possibly with a different css class so to be able to show it with a "lighter" style respect to the rest of the linked breadcrumb (hope i managed to explain myself..)
anyway didn't tested latest version up here yet, bit too late now, but i willl tomorrow ;)
cheers
Comment #18
marcoBauli commentedwow bdragon, the latest version is a real step ahead!
now breadcrumbs show the same for anonymous and authenticated users, and more: my top level menu items stay active even when browsing the final nodes. This really rocks!
Two cents more:
1. as commented in my previous post (eventually see there for slightly better explanation): the final part of the breadcrumb (node title) shouldn't be a link IMO, as there's no reason to link a node to itself and can be confusing for users.
2. now hidden containers do not appear in breadcrumb, but their parents should appear though. So for example, if i have a structure of the kind:
Vehicles (container)
Type (Required hidden container. Parent: Vehicles)
----Cars (category)
actually the breadcrumb for a node tagged by "cars" shows:
Home>>Cars
while it should show:
Home>>Vehicles>>Cars
thank you for considering this
Comment #19
marcoBauli commentedUpdated to latest 4.7 version of Category (1st October: patches about category_get_parents at http://drupal.org/node/76921 were committed):
now hidden containers show again in breadcrumb trails.
Also when browsing the Forums, the breadcrumbs there point to the categories nodes while they should point to the Forum's sections.
Comment #20
marcoBauli commented*bump*
a further note to the comment above:
this actually happens only when reading the node page. It does not happen if you are on a Forum Container or Forum!
might this be related to http://drupal.org/node/84643 ?
@bdragon: what are the plans for this module? i see is marked as CNW..?
@all: is anyone else interested in seeing this module fully work?
ouch..how many doubts ;P
Comment #21
Permanently Undecided commentedI've taken the version posted on #16 and modified it:
1) if you also apply the patch in the following post, it should fix the 'hidden containers showing in breadcrumbs' problem
2) now the current post is always listed in the breadcrumb, but never linked
What I couldn't fix:
1) the function category_get_parents is currently broken, and does not return parents of containers. Fixing it is apparently beyond me, so I've posted an issue about it and hopefully somebody else will take care of it. Until that problem is fixed, containers will still have broken breadcrumbs. All categories will have correct breadcrumbs instead, with all parents (visible containers included) listed.
2) I don't use forums, so I have no idea if forums behave correctly or not
Comment #22
Permanently Undecided commentedHere is the patch I mentioned. It makes a very small change, namely it adds in the database query the value 'hidden_cont' that can tell whether a container is hidden or not. The previous cat_breadcrumb module checked that value to see if it had to display the link or not, but since the value wasn't added to the database query in category.inc in the first place, the check always displayed the links, simply because the real value wasn't actually there. With the patch, the value is actually retrieved from the database and the module can work correctly.
Comment #23
Permanently Undecided commentedThe module I posted in #21 has introduced (or was it already there?) a bug, where nodes assigned to multiple categories get a multiple breadcrumb. I'm not sure on what approach to take in order to fix this; which category among the many should I choose? Any ideas?
Comment #24
Permanently Undecided commentedHere is the fixed version, now the breadcrumb isn't duplicated anymore. You still need the patch in #22, or the hidden containers will show up.
Comment #25
Permanently Undecided commentedThe module still works in Drupal 5 (with the patch in the other issue). You'll need to create a folder called category_breadcrumb for it (I created mine as a subfolder in the contrib folder), add the .info file I'm attaching and you still need the patch in comment #22, or hidden containers will show up.
Comment #26
ilfelice commentedThis is a great module that could save me from having to drop Categories in a site that I am working on, but I see a little problem: it shows the end piece of the breadcrumb trail twice: once as a link, then followed by the same text unlinked.
For example, I have a contained called Development, and the breadcrumb shows:
Home » Development » Development
...instead of just
Home » Development
The same happens with deeper breadcrumbs.
Any way to fix this?
Comment #27
Permanently Undecided commentedIn reference to #26:
the only way I've managed to reproduce this if I have a visible container or a category called 'Development' and then I have a subcategory called 'Development' of that visible container/category. This is correct behavior, since it's a subcategory with the same name. It is however very different from the bug you mention, namely the same item appearing in the breadcrumb twice. I haven't managed to reproduce the latter at all. If you can provide more info (e.g. what versions are you using, and are they the latest? what is your exact hierarchy container/category structure for the buggy item? have you applied the patch in comment #22 to get rid of hidden containers in the path?) so that I can reproduce it, I can try and fix it as soon as I have time.
I do have to point out that the module attached in comment #24 is taking into consideration what comment #17 says, namely that . So if you use the module in #24 you'll always have the current page listed as text only at the end of the breadcrumb (this doesn't mean anything will appear twice). If you do not care for this behavior, use the module attached in #16 instead plus the patch in #22 (that will get rid of hidden containers in the breadcrumb). If I ever manage to find time, it'd be nice to add an option so that admins can choose what kind of behavior they want (i.e. add unlinked current page in the breadcrumb or not).
Comment #28
marcoBauli commentedsolved problem with Forums breadcrumbs at #20 above. Attached you can find working version.
Basically added just the following:
at line 28
Comment #29
mathieu commentedFollowing this, even though I hope I won't need it.
Comment #30
marcoBauli commentedsame thing as #28 is needed in order for good blog breadcrumbs to show.
add following line after the previous forum one:
This way the "Blog" main menu item will be set to active when browsing blog posts, and correct breadcumb is shown too.
Comment #31
bdragon commentedAssigning to self.
Comment #32
bdragon commentedLet's start at HEAD and work backwards, shall we?
Instead of hardcoding content types, let's just let the user decide on the content type edit form.
Something like
Comment #33
marcoBauli commentedbdragon, definitely yes please if you find the time.
mine was just a quick hack being pretty much phpgnorant :)
Comment #34
mathieu commentedTotal +1 from me, this is a must and would save me a lot of trouble.
Comment #35
bdragon commentedHere's a very quick hack to cheat at breadcrumbs. It works for everything that's a category. (Put it in whatever you use for a site customization module, the example is for "mysite_custom.module")
Comment #36
bdragon commentedHmm, now that I think of it, using this and checking for a menu item on the way up would let us expand the menu as far as we can as well as having a breadcrumb...
Comment #37
JirkaRybka commentedOops, what a pity the Issue queue is so long... I overlooked this, and created my own category_breadcrumb module, to match the needs of my website.
It's maybe not so much precised, doesn't do anything about category-pages, but at node level it works fine on the site, and there's no need to work elsewhere, as we're putting Categories to the navigation menu. I think that only the node-level needs to avoid the menu-entries-creation.
--- One important feature in my version: While enabled, multiple breadcrumbs may be generated for one page, to reflect the node being assigned to more categories (i.e. one complete path for each category on the node). On our site, we use two parallel Category-trees to sort contents by both What happened and Where it happened, and so the breadcrumb needs to offer "navigate back" ways to both the trees, otherwise it'll be non-reliable for the user as navigation. It's a bit tricky to pass an Item-list of breadcrumbs to the page, but works fine (if no complicated theming is used on breadcrumbs, which is not usually the case, I believe). Also node-titles are optionally added, to allow having them on all the multiple breadcrumbs.
--- My version also have admin-settings page to control the behaviour (although there's currently not much to be set).
I'm attaching the module I created, which is NOT a modification of the previous ones here. Perhaps someone might put both the versions together, otherwise it's an alternative for anyone searching quick solutions in this thread, and maybe a bit of inspiration.
Comment #38
JirkaRybka commentedOK, there's some more progress from me :-)
I further improved my version of Category_breadcrumb, including ideas and code-snippets from the versions seen earlier in this thread, aiming to put the best from both the versions together. The resulting module seems to me finished, fully working and configurable, so I hope someone review it.
Features:
--- Tested on Category 5.x-1.1, Drupal 5.1
--- Allows normal or multiple breadcrumbs on node-pages (multiple = one path per category, if there are more on the node), or just do-nothing.
--- Allows breadcrumbs on category and container-pages, if enabled.
--- Allows to add node-title to the breadcrumb (linked, plain text, or no title), which might be useful on multiple breadcrumbs.
--- Allows to specify node-types to exclude (forum and blog by default, to avoid mentioned-above problems).
--- Avoids changing another module's explicitly set breadcrumbs.
--- Checks for hidden containers in the same way as previous versions seen here (i.e. needs the patch from #22).
--- Provides full admin-settings page to control the behaviour (including explanations on the settings).
My module doesn't play with menus (that's category_menu's work, so no need to confuse things), relies as much as possible on the existing $node object (to avoid unnecessary complex function calls). The node-types-to-exclude setting is provided just as a textfield - I think that this will be changed rarely. (I'm not voting for the way suggested by bdragon (#32), as this is NOT a content-related workflow-preference, so there's no point overloading other pages with such settings, and make the site-admin pursue them over many different pages. This is just an install-setting-to-avoid-problems on Category_breadcrumb itself, and so it belongs to it's own settings-page, I believe.)
If one choose to add node-titles into breadcrumb for the sake of multiple breadcrumbs being equipped with it (which is not default), it's still a good idea to put something like this into page.tpl.php:
<?php print $breadcrumb . (strpos($breadcrumb,$title) ? '' : ' » '.$title); ?>This ensures the title to be there also on different non-node pages, where Drupal doesn't add it.
Module is attached (remove the .txt extension, which I just needed to attach the file here - Drupal.org seems to disallow .module files as attachments!), the .info file remains unchanged from my previous post.
Comment #39
bdragon commented#38 and .info from #37 added to DRUPAL-5 and HEAD verbatim.
Comment #40
JirkaRybka commentedMy implementation seems to be inside latest -dev release now, so I think this Issue deserves a "fixed" status. Feel free to re-open if there's something else left to be done about this.
Comment #41
(not verified) commented