One of the things that threw me about Drupal is that there is no imposed hierarchy of pages. In fact nodes replace pages and are more like virtual pages that can be mixed and mashed.

I want my site to be a mostly static-looking site with a hierarchy of pages (nodes) at from a user perspective. My first pass was to use the menu and the menu on the fly modules to do this . This works great on one level. In fact a made a short video on how to do this (see http://www.ourmedia.org/node/18042). What is not clear to me is how to make a sub-page or node have a different set of navigation links.

This got me thinking about Taxonomy. Using taxonomy imposes a hierarchy by default so in my case this is good. It also seemed it would be easier to get subsection menus with There are a few taxonomy navigation modules: Taxonomy Dhtml, Taxonomy Menu, and Taxonomy context for example. Here is where Taxonomy doesn't work for me: instead of a hierarchy of pages you get a blog-like listing of posts under a particular category. There is nothing wrong with this, it's just not what I'm looking for in most cases. So, my question is how do I make taxonomy show a category "home page" and a series of "sub-pages" instead of a series of "posts".

The last piece of confusion (for now) is how to integrate roles and permissions with a taxonomy - any advice here is much appreciated.

I am willing to tweak, adjust and even write code to accomplish these things but would like some advice on the best way to proceed.

Thanks

Comments

jbrauer’s picture

One place to start is with some of the php snippets on this site.

Generally:

http://drupal.org/node/23220

And I use this one a lot:

http://drupal.org/node/23232

This will, make it easy to generate a list of nodes, be they pages, stories, blog posts etc. with a certain taxonomy term. This can be useful in either blocks or the main body of a page. I've combined with this (http://drupal.org/node/23449) to show different content (including various categories of taxonomy) to users who are (or aren't) logged in.

These PHP snippets don't include the javascript to do so but it should be pretty trivial to use them to drive a javascript menu or have them produce menus that are CSSified to meet the demands of the template.

--

ghankstef’s picture

I didn't think of this. This may do the trick. I'll try this out and report back with code

ghankstef’s picture

This snippet out put terms and related nodes as nested html lists.
Essentially this lets me create a hierarchy with one master taxonomy vocabulary listing each term and all the nodes in a term sorted by weight. It seems this functionality should be built in but at least Drupal has the flexibility to allow a php hack like this.

<?php
    $vocabulary_id = 4; // vocabulary id for the "master" category 
    $result = db_query("SELECT d.tid, d.name, d.weight  FROM {term_data} d INNER JOIN {term_node} USING (tid) INNER JOIN {node} n USING (nid) WHERE d.vid = $vocabulary_id AND n.status = 1 GROUP BY d.tid, d.name ORDER BY d.weight");
    $items = array();
    $sub_items = array();
    
    while ($category = db_fetch_object($result)) {
        $output .= "<ul>"; // for term list
        $output .= "<li>" . l($category->name, 'taxonomy/term/'. $category->tid) . "</li>";
        $output .= "<ul>"; // for nodes list
        // call function to find all nodes in a term 
        $sub_items = get_nodes_in_term($category->tid);
        // Add nodes to items array
        foreach($sub_items as $val)   {
            $output .= $val;
        }
      $output .= "</ul></li></ul>";   
    }
    print $output;


    function get_nodes_in_term($tid)    {
        $sub_items = array();
        $sql = "SELECT node.title, node.nid FROM node INNER JOIN term_node ON node.nid = term_node.nid WHERE term_node.tid = $tid ";
        $result = db_query($sql);
        while ($anode = db_fetch_object($result)) {
            $sub_items[] = "<li>" . l($anode->title, "node/$anode->nid") . "</li>";
        }
    return $sub_items;
    }
?> 
laura s’s picture

...I ask if you've considered using books hierarchies. Using 'Outline' you can pull any node of any type into a book. You can set order using weighting.

As for roles and permissions, taxonomy access can be used to set access permissions to each term, based on role.

Is this in the neighborhood?

===
Laura
pingV

_____ ____ ___ __ _ _
Laura Scott :: design » blog » tweet

laura s’s picture

IF you're looking for something to organize new submissions as they come in, the book solution obviously would not work. But the php snippets mentioned above could get you where you're going there. Taxonomy context can help on that, too.

===
Laura
pingV

_____ ____ ___ __ _ _
Laura Scott :: design » blog » tweet

ghankstef’s picture

The only thing I don't like about the book module is the previous next navigation at the bottom of the page. I suppose I could hack the module to not show it

eferraiuolo’s picture

I had a client agree with you on this one about the book module navigation at the bottom of the content on each page. There is a really simple fix with css:

This will disable both the book-tree (the list of child pages) and book-nav (the next & previous nav links):

.book { display: none; }

Or if you just want to disable parts of it you could use the following to disable just the book-tree:

.tree { display: none; }

And if you just wanted to disable the book-nav use this:

.nav { display: none; }

There is no need to hack the module, just hack the theme's CSS! ;)

Jaza’s picture

Looks like you are yet another person who will be able to benefit from the proposed category module. I'm coding this module at the moment, but it won't be ready for a few more weeks.

In the meantime, you can make do by using modules such as taxonomy context, distant parent, and taxonomy associations, to give your site a static hierarchy using the taxonomy system.

Jeremy Epstein - GreenAsh

Jeremy Epstein - GreenAsh

zach harkey’s picture

Jaza,

Your 'proposed category module' carries with it the hopes of a nation. Your efforts are in our prayers. God's speed my son, god's speed.

-zach

: z

zach harkey’s picture

...

: z

patrickharris’s picture

Your module would solve all my site structure problems.
BTW, couldn't taxonomy be integrated with the menu, just as well as with the book module?

ghankstef’s picture

See http://drupal.org/node/27904

I have figured much if not most of this out see the node above