I am looking for a way to do hierarchical content similar to the image linked. Just a simple way for me to add content to headings with an image and such. Is there a module out there that is similar to what is seen in the linked pic?

http://splakow.com/sites/default/files/users/albums/root/Untitled.jpg

Comments

cog.rusty’s picture

Maybe the http://drupal.org/project/taxonomy_list module does what you want. Check the demo page http://nanwich.info/taxonomy/vocabulary/2+1 (Not exactly nice, but you are expected to do some theming.)

nancydru’s picture

Taxonomy List (version 2) plus Taxonomy Image will do what you want. But, as was pointed out, it will take a bit of theming to make it look exactly like that.

NancyDru (formerly Nancy W. until I got married to Drupal)

dnewkerk’s picture

This is possible, but unfortunately it's not a "piece of cake" for newbies. Also it is a process I can only recommend doing (this way at least) on Drupal 5, since it involves Panels module which is barely functional in Drupal 6 right now (just released first alpha version recently). My example was done with D6, but it was rough. An alternative to going with Panels would be to embed multiple Views in a node or template file.

Example embedding a Views 2 view (more details):

<?php
  $view = views_get_view('viewname');
  print $view->preview('default');
?>

Here's the result of me building something like this just now, by configuring Taxonomy, Views, and Panels (no programming at all):
http://www.davidnewkerk.com/files/img/taxonomy-powered-panels.png

What it basically boils down to is just a normal Views listing, however one which changes depending on the taxonomy term argument it receives (yes that does sound very complex - hopefully sometime soon I can write a guide to help... basically in a single-page View if you added a taxonomy term argument to it, and then added that to the end of the URL, it would filter the results to just those that match that taxonomy term). The harder part though is putting more than one of them together on the same single page, which is where Panels comes in. Not too hard with Panels, other than Panels for Drupal 6 being rather broken still.

This was done with the following modules: Taxonomy (Drupal 6 core), Views 6.x-2.0-rc4, and Panels 6.x-2.x-dev.

- Taxonomy vocabulary called for instance "Directory Category" (call it whatever you want). I set this Vocabulary to appear on Story content type forms. Add terms to this vocabulary that you want to categorize content with (e.g. I've added "Drupal lessons and resources" and "Cool Drupal modules"). I suggest you use these two terms initially since they're referenced in the code I'm giving below, so it's more likely to import correctly if you do have those terms. You can rename them once everything is working.

- Add several Story content items and add them to the terms you created so they'll be categorized.

- Next you unfortunately have to patch a bug in Panels module (D6)... I used the 6.x-2.x-dev version, but I think this would work the same for 6.x-2.0-alpha1, (needed since it has trouble receiving arguments in the current version). Open panels/panels_views/panels_views.module and find 2 instances of $block->content = $view->preview(); and replace it with $block->content = $view->preview(NULL, $args);. This should be fixed automatically in alpha2, so you only have to do this once.

- The next part I don't have time to explain "how" to do right now, but will give you the Views and Panels code to import (which might work):

Views 2 (Drupal 6):

$view = new view;
$view->name = 'directory_category';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
  'title' => array(
    'label' => '',
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
  ),
  'teaser' => array(
    'label' => '',
    'exclude' => 0,
    'id' => 'teaser',
    'table' => 'node_revisions',
    'field' => 'teaser',
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'name' => array(
    'default_action' => 'ignore',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => 'Category: %1',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'glossary' => 0,
    'limit' => '0',
    'case' => 'none',
    'path_case' => 'none',
    'transform_dash' => 1,
    'add_table' => 0,
    'require_value' => 0,
    'id' => 'name',
    'table' => 'term_data',
    'field' => 'name',
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'poll' => 0,
      'forum' => 0,
      'article' => 0,
      'book' => 0,
      'imagefields' => 0,
      'imageimage' => 0,
      'page' => 0,
      'player' => 0,
      'prayer_need' => 0,
      'section' => 0,
      'some_type' => 0,
      'story' => 0,
      'team' => 0,
      'tutorial' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '1' => 0,
      '2' => 0,
      '7' => 0,
      '3' => 0,
      '4' => 0,
      '5' => 0,
      '6' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_php' => '',
  ),
));
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => 1,
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('use_pager', '0');
$handler->override_option('use_more', 1);
$handler->override_option('style_plugin', 'list');
$handler->override_option('style_options', array(
  'grouping' => '',
  'type' => 'ul',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'directory/more');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));
$handler = $view->new_display('panel_pane', 'Panel pane', 'panel_pane_1');
$handler->override_option('pane_title', '');
$handler->override_option('pane_description', '');
$handler->override_option('pane_category', array(
  'name' => 'View panes',
  'weight' => 0,
));
$handler->override_option('allow', array(
  'use_pager' => FALSE,
  'items_per_page' => FALSE,
  'offset' => FALSE,
  'link_to_view' => FALSE,
  'more_link' => FALSE,
  'path_override' => FALSE,
));
$handler->override_option('argument_input', array(
  'name' => array(
    'type' => 'user',
    'context' => 'any',
    'panel' => '0',
    'fixed' => '',
    'label' => 'Taxonomy: Term',
  ),
));
$handler->override_option('link_to_view', '1');
$handler->override_option('inherit_panels_path', '0');

Panels 2 (Drupal 6):

/**
 * Implementation of hook_default_panel_pages()
 */
function Directory_default_panel_pages() {
  $page = new stdClass();
  $page->pid = 'new';
    $page->pid = '1';
    $page->name = 'directory';
    $page->did = '1';
    $page->title = 'Directory';
    $page->access = array();
    $page->path = 'directory';
    $page->load_flags = 0;
    $page->css_id = '';
    $page->css = '';
    $page->arguments = array();
    $page->relationships = array();
    $page->no_blocks = '0';
    $page->switcher_options = array();
    $page->menu = '0';
    $page->menu_tab = '0';
    $page->menu_tab_weight = '0';
    $page->menu_title = '';
    $page->menu_tab_default = '0';
    $page->menu_tab_default_parent_type = 'tab';
    $page->menu_parent_title = '';
    $page->menu_parent_tab_weight = '0';
  $page->contexts = array();
  $display = new panels_display();
  $display->did = 'new';
  $display->layout = 'twocol';
  $display->layout_settings = array();
  $display->panel_settings = array();
  $display->content = array();
  $display->panels = array();
    $pane = new stdClass();
      $pane->pid = 'new-1';
      $pane->panel = 'left';
      $pane->type = 'views_panes';
      $pane->subtype = 'directory_category-panel_pane_1';
      $pane->access = array();
      $pane->configuration = array(
        'style' => 'default',
        'override_title' => 1,
        'override_title_text' => 'Drupal lessons and resources',
        'css_id' => 'drupal-lessons',
        'css_class' => '',
        'arguments' => 
        array(
          'name' => 'Drupal lessons and resources',
        ),
      );
    $display->content['new-1'] = $pane;
    $display->panels['left'][0] = 'new-1';
    $pane = new stdClass();
      $pane->pid = 'new-2';
      $pane->panel = 'right';
      $pane->type = 'views_panes';
      $pane->subtype = 'directory_category-panel_pane_1';
      $pane->access = array();
      $pane->configuration = array(
        'style' => 'default',
        'override_title' => 1,
        'override_title_text' => 'Cool Drupal modules',
        'css_id' => 'drupal-modules',
        'css_class' => '',
        'arguments' => 
        array(
          'name' => 'Cool Drupal modules',
        ),
      );
    $display->content['new-2'] = $pane;
    $display->panels['right'][0] = 'new-2';
  $page->display = $display;
  $page->displays = array();
  $pages['directory'] = $page;


  return $pages;
}

And lastly to add the images and make the links bold, add to style.css:

#drupal-lessons {
  background: url(term-icon1.png) top right no-repeat;
}

#drupal-modules {
  background: url(term-icon2.png) top right no-repeat;
}

.views-field-title a {
  font-weight: bold;
}

These CSS ID#'s are assigned in the Panel panes.

There's a module called Taxonomy image which I thought I might use to give an image for each Term using just Drupal, but on short notice couldn't discover how to make use of the image "only" in the title (it appears next to every item)... so I went with CSS (which I probably would do anyhow, since it is more semantically correct than including an image directly in the page for this purpose).

-- David
absolutecross.com
[new guide/lesson in progress: Creating a CCK and Views powered Drupal site - feedback welcome]

alan d.’s picture

There is a devel version of insert_view for D6

Using this, you can create a standard page with a table / floating divs and use the insert view tag for each section.

eg:

<table>
  <tr>
    <td>[view:content_view=50=45][view:content_view=50=48][view:content_view=50=46]</td>
    <td>[view:content_view=50=41][view:content_view=50=58]</td>
  </tr>
</table>

The new tag, [view:content_view=50=45], means insert a view ([view:...]) called content_view, using only the first 50 items returned, and pass in the argument 45.

If you format the view to just do the title link listing, you can move all other formatting into the normal Drupal page content.


Alan Davison
www.caignwebs.com.au

Alan Davison
dnewkerk’s picture

Yep another good idea. Thanks, I'll install that and give it a spin too. The View is really the meat and potatoes of the process... once you have that you can make use of it in many ways, with various other modules, or directly in template files.

View Reference might work along these lines as well.

Edit: using View Reference you could simulate similar functionality to Panels panes by setting up a CCK type with a few (2 for instance) View Reference fields with the "Number of values" option set to Unlimited. Then you could add more Views in a similar way as adding Panel panes. Then put the 2 (or more) View Reference fields into columns in your node template, and viola, Panels simulation :)

-- David
absolutecross.com
[new guide/lesson in progress: Creating a CCK and Views powered Drupal site - feedback welcome]

cochran242’s picture

Keyz and Alan,
THANK YOU SOOOOOO MUCH.

I am very appreciative for all of your help. With both suggestions I was on track in no time and now just need to tweak my design.

For anyone else reading, I imported KEYZ Views script and used View_Panel