开发者

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

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_lin开发者_运维问答k('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.

Anyone please help,


Check out the Taxonomy Lineage module:

http://drupal.org/project/lineage

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜