Quantcast
Viewing all articles
Browse latest Browse all 49204

how to display Node Terms in block with tree structure in Drupal?

Hey guys,

I just enabled multiple terms for node creation and i just wanna display those mulitple terms as a tree sturctured in a block i tried with the following code

 if ( arg(0) == 'node' && is_numeric(arg(1)) ) {
 $node = node_load(arg(1));
 if (module_exists('taxonomy')) {
 $terms = taxonomy_link('taxonomy terms', $node);
 print theme('links', $terms, array('class' => 'node-terms'));
} else {
  print 'No associated categories.';
 }
 }

But no luck its just displaying all terms, But i have to display like below

 - parent term1 
    - sub term 1.1
 - parent term 2
    - sub term 2.1
      -- sub sub term 2.1.3

Based on the user selected will display accordingly as a tree in a block on that corresponding node page.

Anyone please help,


Viewing all articles
Browse latest Browse all 49204

Trending Articles