Views and Categories - How Do I Do This?
Gang -
I'm dealing with an issue that has been going for awhile now. I will try to describe it as best as I can, and I am including a link to a screenshot that will hopefully help illustrate my issue.
My goal was to take a taxonomy/category (whatever language you prefer) and use it as a tool for navigation. This taxonomy is used to assign general topics to posts. Users would like to be able to browse content by topic - ergo, browse by taxonomy term.
In order to accomplish this goal, I created a view, and enabled said view as a block. This is coming very close to what I want, and looks like the following:
Please view a screenshot here.
What I still need to do, however, is havet his behave in a way such that the taxonomy term's parents are displayed, and that the subsequent terms are displayed beneath them in a collapsable/expandable way, much like a menu.
Right now, only terms that have content assigned to them are being displayed, and I think that will be fine, but they lack context and so the parent really must be made visible, and the information then displayed in a hierarchical way.
PLEASE HELP.
This has been driving me crazy and no one has seemed to be able to give me direction. I hope the screenshot will help.

hmmm
I'm not sure on taxonmony but the module category itself does this by default if you follow the tutorial at the documentation website for it. The category module is not the same as the default taxonmony module installed in drupal by default.
Hm. I am quite certain I
Hm. I am quite certain I have thoroughly read the related documentation, so could you give me a specific pointer to the documentation to which you are referring? I'd really appreciate it.
I am using a module called "taxonomy," and that comes up as "categories" in my Administer> menu.
ore is referring to the
ore is referring to the contrib download called categories. it extends the taxonomy module. its documentation can be found here http://category.greenash.net.au/docs
Still looking for a pointer
Still looking for a pointer to the tutorial you referenced above. I can't seem to locate it on my own. Thanks a lot if you can help.
Its under tutorials instead of docs at greenash
http://category.greenash.net.au/node/91
Hope this helps
This site is in development
This site is in development but does what you want - so is proof of concept of the category module doing this by default.
http://www.churchandcivilweddings.co.uk/ - see the 'Wedding Guides' menu on the left, thats the one...
Use category module, it rocks once you now how.
Thank you! Your site _is_
Thank you! Your site _is_ what I want to do! The only other thing I'd want from that is the ability to collapse/expand the "headers." I will get on examining Categories.module straightaway and hopefully implement it - sooner rather than later.
Thanks.
jmburnz, I am a bit
jmburnz, I am a bit intrigued about how you got 'wedding-guides' to appear in the urls without making it a clickable link in the menu. Is that a container or a custom menu (that is, you are not using cat_menu module?). Also, what are the pathauto patterns that give you this url structure? Are you using menupath?
Would be great if you could share this info.
----
Previously user Ramdak. Feeling comfortable enough to use my real name after two years with drupal;-)
Wedding Guides is the
Wedding Guides is the container which is then disabled as a menu item... so thats the trick - and to use category_menu. Everything else is a category/sub category etc. We wanted those keywords in the URL (wedding-guide) but we didnt see much point in having it in the menu since most users will want to dive right in to a specific category anyway.
The path settings for containers and categories is [menupath], so you are right on all accounts - well spotted!
I've found menupath and menu to be the most usefull.
Dear Category Gurus
With your help, I'm finally getting there. I've detailed my latest issue in this thread. I'm sure I'm just missing a step somewhere. Can anyone share any insight?
Thanks again; you've been very helpful thus far. I hope to try the trick you describe above, jmburnz, once I get things working, in general.
Sorry for what must be
Sorry for what must be obtuse questions, but I am really struggling to understand the philosphy behind category.mod (and drupal, in general, for that matter). Do I disable menu.mod in favor of category_menu? Is the latter what will allow me to have topic headers (read: child categories) that don't behave as though they were regular content nodes (e.g. story; page, etc.)? Because I don't want them to; I simply want them to be headers, and the child categories they contain to populate all nodes assigned with that child.
Thanks.
I'm also still struggling with the menuing issues as reported here. Things are not behaving as seamlessly as the directions might lead you to believe they should.
Do I disable menu.mod in
No, cat_menu uses the menu system in drupal core. This means that although you can enable cat_menu and have your navigation built automatically (under the default admin/navigation location), you can also turn it off and build your menu items by hand. But, this would be defeating the very purpose for which you wanted to try category in the first place!
The alternative is to let category_menu build the navigation and then go to admin/menu, add your custom menu and move the category hierarchy built by the category module into that menu as explained in the comment to which you referred.
Exactly what are the problems you are facing? I think it may have something to do with the fact that you created the containers and categories afresh - effectively two sets of vocabularies and taxonomy terms. Once you install category and its taxonomy wrapper, you can also enable category_legacy which helps you to import the existing vocabs and taxonomy terms into the site and converts them automatically into containers and categories.
Also please be aware that due to underlying problems (recently fixed) in menu_otf module which was added to core drupal in 4.6, dealing with menu items was a real nightmare in category module. If you can give further details about your exact troubles, someone can help you troubleshoot.
Previously user Ramdak. Feeling comfortable enough to use my real name after two years with drupal;-)
Hi, again. I'm working in a
Hi, again.
I'm working in a completely new instance of Drupal. I added the Category module, enabled the taxonomy_wrapper and imported the taxonomies (supposedly). In this post above you say that I should use "category_legacy." I've enabled it, but what do I _do_ with it? It seems like a number of the category pieces - _legacy, _display, and so on - would be useful to me, but I do not understand how I am supposed to be administering them.
This is so frustrating.
Getting There
So I now have a series of menu items consisting of containers, child containers, categories and child categories. The categories and child categories will yield content that has been assigned to them. But the containers and child containers provide a node view that I don't want users to see. I want to effectively turn this off, and have clicking on the containers/child containers do nothing more than expand menus, but populate nothing into the main drupal body - I don't want these to appear as nodes at all, to end users.
How can I do this? Simply disabling them a a menu item just removes them from the hierarchy - not the desired effect.
Thanks for everyone's continued help.
Another Wrinkle
Sorry for the double-post; I'm not sure what's up with that.
Here's another wrinkle:
I've gotten to the point where I have categories/child categories, so I went to a legacy post on my dev drupal box (where I've been learning the category module, and thank God I have it), and when I tried to assign it a category...no dice. I have a box with the name of the (new category module) category/vocabulary, but there are no items within the box from which to select. I suppose this is because, instead of using taxonomy_wrapper from the start, I deleted and an am now rebuilding by hand my category/vocabulary. So how do I assign content to these categories?
This is maddening.
I agree wholeheartedly with the other poster on this thread that clearer language must be used (including, for a start, a different module name to differentiate from drupal's on-board stuff) so that neophytes like myself have more than a snowball's chance in hell of getting things working.
Thanks again.
Have you added the relevant
Have you added the relevant content type to the container?
This stuff takes time to learn for newbies, a lot of testing, reconfiguring, reading etc. Give it time, it will start to 'gel' and one day you will wake up and just 'get it'.
DUH! I AM SURE THAT IS IT.
DUH!
I AM SURE THAT IS IT. I KISS YOU!!11one
If I set the original
If I set the original container to be enabled for node types, can the child containers/categories, all of which report back to that first container, inherit those qualities or must I set each by hand?
(P.S. Any ideas on the other query? I thought you might be the person to know...)
If I set the original
No, child containers do not inherit the settings of the parent container. Depending on your point of view, this can look like either a big advantage or disadvantage of the category module. For me, it is something that gives category module great power- the ability to restrict content types to specific containers (and their categories) within a single category hierarchy. You can't do this with the core taxonomy module.
Of course, the downside is that you have to remember to enable your content types for the child containers.
----
Previously user Ramdak. Feeling comfortable enough to use my real name after two years with drupal;-)
Container TOC display setting inherited?
Hmm... my TOC display setting seems to be inherited.
My structure:
container (TOC disabled)
--category
----subcontainer (TOC enabled)
------subcategory
--------pages
Unfortunately, subcontainer TOC not displayed. If container TOC enabled, then subcontainer TOC appears.
I tried every "Display (x) nodes" PHP snippet. I ended up writing my own, which lists all pages under subcategory. But the reason I created subcontainer in the first place, was to have a TOC with prev/next links (category.module is so fitting for this purpose).
Any ideas? Has this occured to anyone else?
-------------------------------------------------
AdAstra.ca - Optimze the Web. Optimze the World.
Hmm... my TOC display
I hadn't noticed that. It's either something new or I am wrong wrt to ToC at least. As far I know, the content type settings at least are not inherited.
----
Previously user Ramdak. Feeling comfortable enough to use my real name after two years with drupal;-)
Where is this "TOC
Where is this "TOC enabled/disabled" setting, and would this resolve my issue as described above, with regard to wanting some categories to not appear as nodes, editable and publishable, at all, but just as category headers?
I'm starting to think that Drupal needs a new node type of category or tag. That would have resolved all of my problems before they began.
Also, because I want to use my category hierarchy as a hierarchical tagging tool, I've discovered my only option is to have one major container with everything else being a category or child category to that container, or I end up with as many selectable menus as I have containers, even when those containers are "child containers" of my main topic header.
Of course, I could just be doing something wrong...again.
Getting There
So I now have a series of menu items consisting of containers, child containers, categories and child categories. The categories and child categories will yield content that has been assigned to them. But the containers and child containers provide a node view that I don't want users to see. I want to effectively turn this off, and have clicking on the containers/child containers do nothing more than expand menus, but populate nothing into the main drupal body - I don't want these to appear as nodes at all, to end users.
How can I do this? Simply disabling them a a menu item just removes them from the hierarchy - not the desired effect.
Thanks for everyone's continued help.
When you say 'populate
When you say 'populate nothing into the main body...' what do you mean by nothing? Something has to be there, so what is it - the current page view?
You can change the path of each menu item, so you could point it at a custom view (as an example). I realise this does not solve your problem, just mentioned it to point out that you dont have to have the container node.
I want either a blank page,
I want either a blank page, or a list of the child categories/containers that container contains (ugh, this LANGUAGE!). Ideally, though, I want a click on the containers to do...nothing appreciable to the end user, other than to expand or collapse the menu system. This is the crux of what I've been trying to create this whole time.
On another interesting note
I just logged in using a test account I maintain on my development server. The test account, a regular authenticated user, cannot see the block I created containing my container/category menu hierarchy. I'm sure I'm overlooking something really obvious here, but where should I check? In Administer>Access Control, all authenticated and anon user access to categories is turned off, but that should affect the viewing of them (just the creation/administering of them). Hmm...
Grab the Views Bonus Pack
Grab the Views Bonus Pack and the Taxonomy Lineage modules. The two of them provide a plugin (which will show up as a new view type, I believe) that will, I think, help you out with that.
-- Merlin
[Point the finger: Assign Blame!]
[Read my writing: ehalseymiles.com]
[Read my Coding blog: Angry Donuts]
After banging my head
After banging my head against the wall with Category, I'm trying your suggestion, Merlin, in a dev sandbox version of my Drupal instance. Naturally, I am finding it about as clear as mud in terms of setup. Are you able to offer further enlightenment?
Thanks.
don't understand how to..
Hi Merlin,
as i have the very same problem, I really tried to use your tip provided here, but i did not get it.
How do i get a nested navigatable hierarchy menu using lineage and the views bonus stuff ?? Could u be so kind, and give a short instruction?
List nodes from a category
Hi,
I am not sure whether this is correctly addressing Sarahr's initial question, but I finally managed to include the title of the nodes belonging to a category in a TOC. I modified the
"theme_category_display_toc_link" function in category_display.module (I used Drupal 4.7.4).
All nodes that belong to a category will show up below it in the TOC. In my case, I did have to place some restrictions because I did want only nodes of a certain type to be listed in the TOC. My example can be found at http://www.gazetejo.org/ -- for instance : http://www.gazetejo.org/eo/node/16 or http://www.gazetejo.org/eo/node/15 where the most indented items are nodes that belong to the categories above them.
/**
* Formats a link in a category's TOC display, and appends an assigned node
* count if applicable.
*
* @ingroup themeable
*/
function theme_category_display_toc_link($category, $orig_node) {
$add='';
$temp_cid= $category->cid;
$sql = "SELECT n.title,n.nid FROM {node} n INNER JOIN {category_node} cn ON cn.nid=n.nid WHERE cn.cid=" . $temp_cid . " ORDER BY n.title";
$query=db_query($sql);
while ($result = db_fetch_array($query))
{
$add .= '<ul><li class="leaf">'. l($result['title'], 'node/' . $result['nid']) . '</li></ul>';
}
return l($category->title, 'node/'. $category->cid). ($orig_node->toc_nodecount && $category->cnid ? ' <span class="category-toc-node-count">('. category_category_count_nodes($category->cid). ')</span>' : '') . '<br> ' . $add;
}