Creating a basic hybrid structure

This tutorial will teach you how to create a basic hybrid structure using the categoryi module. A hybrid category structure is a bit like a hybrid animal (more resistant to fleas), a hybrid car (makes all your friends jealous), and a hybrid towel (even more useful than a regular towel).

A basic hybrid structure is also a hyped-up term, as it deliberately exploits the term 'hybrid' as a buzzword, in order to pointlessly exaggerate the greatness of the category module. I think it sounds alright: it manages to actually convey some meaning, while also sounding very impressive with its seeming sophistication.

Anyway, moving on to the useful stuff...

A basic hybrid structure is the simplest and most common way in which you can combine the usual structures that are possible with the book and taxonomy modules. In this tutorial, you're going to learn how to create a basic hybrid structure that looks like this:

Basic hybrid structure diagram
A typical basic hybrid category structure looks something like this.

As well as simply creating the structure, you will be introduced to the various options for navigation and display that can make it more usable for your site's visitors, and more maintainable for your site's contributors.

Assumed knowledge for this tutorial

Before continuing, you should already have the category package installed on a Drupal system, and you should be familiar with the steps involved in creating and editing categories and containeris. This tutorial is not concerned with teaching you the basics of using the category module (which you should already know, if you're familiar with the basics of using any node types in Drupal). Rather, it focuses on a particular strategy that you can employ when architecting your site with categories.

You don't have to be particularly familiar with all the settings available to you, when configuring your categories and containers. The idea is that as you go throguh this tutorial, you will be introduced to many of these settings, and will learn how to use them to your best advantage.

Note: it is assumed that you have the category, category_menu, and category_display modules enabled.

What are we trying to do?

For the purposes of this tutorial, we're going to be creating our category structure with these aims in mind:

  • Our site will have two node types (apart from category and container), called news and blog, and these node types will be used to create dynamic content
  • All dynamic pieces of content will be listed on the articles page of the site, which will sit as a top-level page (with only home above it)
  • All news items will be listed on the news page, and all blog entries will be listed on the blog page - each of these pages will be underneath the articles page
  • All news items will be categorised by topic, and all blog entries will be categorised by topic and by mood (the news topics will be different to the blog topics)
  • The news topics will all be listed beneath the topics page, which will be beneath the news page; and the blog topics and moods will be listed beneath the topics and moods pages respectively, which will in turn be beneath the blog page
  • Although news items and blog entries will be listed in 3 different places (i.e. articles, news / blog, and the various categories beneath), their actual position in the structure will be beneath news and blog respectively
  • The breadcrumbs, menu links, table of contents links, and navigation links must match this structure perfectly

These aims will not be exactly the aims that you have for your own site. Everybody's aims are different, and this is why the category module tries to be as flexible as possible. But hopefully they are similar enough to your needs that you can spot the similarities, and can take away the lessons that you need.

General Company Website Navigation

Hi Jaza,

I'm a Drupal newbie.

It looks like your module is very interesting. I would like to use Drupal for my website, but I got some problems with the navigation.

My website has 2 level of navigation (primary and secondary). When the primary link clicked, the page will load a set of coresponding secondary menu.

Here's a site that has similar appearance with my site (Sorry for using Joomla site as an example. I used to be Joomla user)

1. http://joomla.org/
Primary Menu: Main Menu
Secondary Menu:
- What is Joomla?
- About Us
- FAQ
- Official News
- Joomla License
- ...

2. http://www.joomla.org/content/blogcategory/0/33/
Primary Menu: News Menu
Secondary Menu:
- Submit your News
- Official News
- General News
- Community News
- Community Sites
- ...

Can I make such site using your module?

Thank you for your attention and sorry for my bad english.

A few possibilities

What you want to achieve is certainly possible with the categoryi module and Drupal 4.7 - but there are a few different approaches you can take.

The easier approach would be to create your 'primary links' menu items using the built-in menu module, rather than the category module, and then to create menu blocks with menu items for each of your second-level menus (which would be in containeris that have one of the top-level pages as their distant parentiis).

The harder approach would be to actually use the 'secondary menu items' mechanism as your side menu block. Since secondary menu items are displayed by default (in most themes) along the top of the page, you would have to override the default display in your site's theme, to show the secondary links as a side block. This might actually work better in the long run, since you could have all your pages as categories within one container, and you might not have to worry about distant parents at all.

But anyway, all of this is quite complex stuff, and as someone who's new to the category module, and to Drupal in general, I think you should do a lot of exploring and learning first, before you dive into tasks such as this. ;-)

how to approach menus

I am just starting to 'get' the categoryi module and it seems immensely powerful.

What I would like to do is have a typical 3-level site structure. For example:

About
-Who We Are
-Our Team
--John
--Bob
Services
-Service 1
--Feature A
--Feature B
...etc etc

This is all easy to do out of the box. But, I want to have the top-level menu items horizonally across the top of the page, and only display the relevant sub-items in the left-nav. For example, if you were in the "About" section, the left nav menu would only display the following:

Who We Are
Our Team
-John
-Bob

It seems the best way to do this would be to have each containeri use a different menu block, but it seems that you can only assign one global menu for all containers/categories to use. Is there a work around for this? Perhaps using CSS?

Thanks,
chud

solution?

It seems the answer to this might be very simple.

I just created a new menu block, and moved the menu item for the containeri there. Now when I add child categories or nodes to the categories the menu items show up in the new menu block I created. Sweet! This post was helpful: http://drupal.org/node/66505

But if there's any other tips out there please post a reply and let me know. :)

Breadcrumbs and menus

Category is a fantastic module -- lots of useful features. I am running up against a problem though.

I have a containeri (Sections) with several categories (News, Arts, Sports, etc).

When "menu items for assigned nodeis" is set to "Enabled (but disable each item)", I get perfect breadcrumbs (Home > Arts > Drama). However, this creates a 'menu item' for every node -- this will rapidly become unwieldy.

However, when I set "menu items for assigned notes" to "Disabled", the menu problem is solved, but the breadcrumb is an awful: Home > content.

Is there any way around this problem?

Uhh...

Not really. Category_menu works by creating menu items. Menu items are then used by the core menu module to set breadcrumbs. No menu items equals no breadcrumbs.

But when you use the 'enabled (but disable each item)' setting, you should only be seeing the breadcrumbs, not the menu links in your navigation. How is this a problem? How will lots of menu items become unwieldy? They're all invisible (except for the effect that they have on breadcrumbs). And Drupal is able to cope with thousands of them (I believe benchmarking has been done with more than 10,000, and has given good results). And categoryi_menu maintains them, so that they continue to match your category structure should you change it.

How to make a node with sub navigation links and related links?

Dear Jaza,

I'm new to Drupal. I want to make a node which has sub navigation links and related node links?

Here's the snapshot of the node that I want to make.

Can I use Category Module? How to achieve it? Can you please explain to me. I'm really stuck.

Jaza, I also submit this question to Drupal forum. If you want to answer in Drupal forum, here's the link to the question I made in Drupal forum.

Thank you very much for your help.

Regards,

Drupal Newbie

Moving the TOC display

Right now, I have the TOC enabled for all containeris/categories. I envision that to be a sort of a sub-menu on each categoryi page.

For that it would be a good idea to have the TOC displayed at the top of the content. Is there some way to display the TOC at the top instead of the bottom of the page?

Thanks, any help would be appreciated.

Override theme function

To show the TOC above your node's content, simply override the theme_categoryi_view() function in your site's theme. Your custom theme function would look something like this (only the bit that needs to be changed is shown here - the rest is snipped):

<?php
function mytheme_category_view($node) {
 
// snip.. all code in here can be the same as for theme_category_view().

  // Allow other modules to add additional output.
 
$extra module_invoke_all('category''view'$node);
 
$extra_output '';
  if (isset(
$extra) && is_array($extra)) {
    foreach (
$extra as $key => $value) {
     
$extra_output .= $value;
    }
  }
 
$node->body $extra_output $node_body;

 
// snip.. all code in here can be the same as for theme_category_view().
}
?>

Hope that helps.

Possible bug in Category module

I've installed the Category module, but I'm having this problem:

1. I create a menu (not a menu item, but a menu)
2. I assign that menu in a block to the left hand side
3. I create content (containeri). In "container information", in the Parent: select list, I leave it set as root
. In "menu settings" I give it a title and I set parenti item to my newly created menu.

What I find is that this container appears in a completely different menu, and not with the "menu settings" title, but with the container title. Once the container is submitted, I cannot change the "menu settings" parent item to anything other than the one it has mysteriously been set to.

Because I'm new, I could be going about things the wrong way. I'm trying to create containers and categories (in a tree structure) and attach them to menus to create navigation for the user. Is this a good way to do it?

Interestingly, if I delete that menu which has had categories assigned to it, the categories then get assigned to 'Navigation' instead. Now, when I try and create a new categoryi and assign its menu settings parent item, it gets stuck on 'Navigation'.

Jonny

UPDATE
I have noticed that if I go to admin/settings/category and in "menu item settings" I change the default menu to the one I want, then when I create a category it gets assigned to that menu.

How can I costomize view of tags in theme?

Tags of node maybe theming something like this:

print $terms

but my each node has several categories from 2 containeris and I want to view from what container each categoryi.

For example my node has category '1 day' from container 'Length' and categories 'London', 'Paris' from container 'Cities'. Now in design it seems like this: '1 day | London | Paris', but I want it would be like this: 'Length of tour: 1 day; Cities: London, Paris'.

thank you

Tertiary menu blocks

I have created a block and....I want the block to display the tertiary menu items.
Uptill now I have the primary and secondary menu items in seperate areas in the site and they work fine. But I can't even get the tertiary menu items to display in any area at all. I thought it would be better to use the categoryi module for this so I made the site structure into the category module. But now I still can't figuere out how to do this.
How would I get just the tertiary menu items to display either in the site or in a block???
I can't seem to figuere this out....please help.

Probably a simple answer...

Hi all.

I have a quick question that probably has a simple answer that I'm missing. I am really enjoying the ease of the categoryi module, however, and just need to figure this one part out.

I have the current structure in place.

Historical References (containeri)
- Culture (container)
-- Society Values (category)
-- Home Life (category)

You get the idea, yes? Ok. What I would like to do is, when I post a story under one of those categories, to have it automatically show under...like so..

Historical References (container)
- Culture (container)
-- Society Values (category)
--- Women's roles (story(ies) / child-category(?))
--- Servants (story(ies) / child category (?) )
-- Home Life (category)
--- 'modern conveniences' (story(ies) / child category (?))

Is this possible? Am I missing a tick mark somewhere to enable this? Please let me know. Thank you so very much.

-- Anna

Confused

This module is fantastic, and I am really wanting to use for my next endeavor, however, I am stuck... I am trying to create a "hybrid" stucture that is really starting to give me some headache. What I would like to achive is as follows...

1.) Create a content type called Tutorial (done... with CCK)
2.) Create a containeri labeled Style: (done...)
3.) Create child categories under Style (C++, Java, etc.) (done..)
4.) Create a container labeled Level: (done...)
5.) Create child categories under Level (Advanced, Beginning, etc.) (done..)
6.) Assign both Style and Level to the Tutorial content type. (done...)

So now I have this structure...

Tutorials
- Level
-- Advanced
-- Intermediate
-- Beginning

- Style
-- C++
-- C#
-- Java
-- ... (the list goes on and on)

7.) ...

Here is where I am stuck... What I want to do is to create a heirachial structure that would allow me to have the Level container as a child of EACH Style categoryi... This is so that I can have a breadcrumb as follows.

Home/C++/Advanced - Shows advanced C++ tutorials.
Home/C++ - Shows all C++ tutorials, but gives me an option at the top to specify the Level of the tutorial.
Home/Java/Beginning - Shows beginning Java tutorials.

I have been playing around with with Distant Parent feature, but I still have not been able to successfuly achieve this heirarchy structure.

Please advise. Your help is greatly appreciated.

Thanks,

Travis.

Could you find the solution?

Hi Travis,
I'm looking for a solution to similar requirement.

I'm building a web site for my college. I plan to create similar hierarchyi for each department, i.e. at first level there are different departments like CS, ME, Maths etc. and within each we have People (Faculty, Students, Alumni), Research (Projects, Labs) and Courses. There should be separate roles for Site Admin, Department Admin and Authenticated User.

Site Admin will have total control over the site.
Department Admin should be able to add/delete/modify content for their departments only and also add/remove users with view permission only.
Authenticated user should be able to view the entire site whereas anonymous user should have limited view access.

I'd also like to create separate menus for each role.

Breadcrumbs should look like:

Home>CS Dept>People>Students>MS
Home>Maths Dept>People>Students>MS

Question
1. What modules can accomplish the above access control requirements.
2. How can we create a user and associate him with a particular department so that when he is assigned Department Admin role, he is allowed to maintain content and users for that department only.
3. Is it possible to have cardinality in roles, e.g. only one user can be assigned System Admin etc.

Thanks. Any support is welcome.

multiple parents?

I have read both in admin pages for categoryi module and here: http://category.greenash.net.au/features that categories with multiple parenti categories is achievable. But, hybrid structure shown above does not show example of this - it doesn't even show a category with a category as its parent (only shows containeris as category parents - although i know it is possible to have category a parent of another category).

Have i mis-read this? Is it possible to have a category with multiple parent categories. Presumably with one of these parents as the "true" parent for the sake of breadcrumbs, etc.

Possible, but discouraged

In the Drupal 5 version, it is possible to have a categoryi with multiple parenti categories, and to also have menu item generated. The parent of the menu item is the parent category with the lightest weighti.

In Drupal 6, the use of multiple parents has been limited significantly. The new rule is that you cannot use multiple parents for any categories in a given containeri, if you want category_menu to generate menu items for that container and its categories. Basically, breadcrumbs / menu-links and multiple parents do not mix well.