开发者

Show Drupal taxonomy subcategories (subterms) on a node page

开发者 https://www.devze.com 2023-01-20 22:58 出处:网络
I would like to ask some Drupaler for help. Is it possible to show the subcategories of a taxonomy term on a node page? Let\'s say that a have taxonomy like this:

I would like to ask some Drupaler for help. Is it possible to show the subcategories of a taxonomy term on a node page? Let's say that a have taxonomy like this:

category 1
       subcategory 1
       subcategory 开发者_高级运维2
       ...

And I want for Ubercart product to show on a node page that an item from category 1 has following subcategories (e.g. products) subcat. 1. and to list a link to the taxonomy subcategory ther.

Heading
some text...
List of subcats...
footer.

It doesn't have to be in this order.. It just ilustrates the idea. Is this possible? Thanks in advance for help.


Hi all and thanks for your replies. I found a way how to accomplish this with modules.

 1. Enable Taxonomy menu module
 2. Enable menu block module
 3. Choose in the menu block created your taxonomy menu
 4. Check the "Make the starting level follow the active menu item." option and place the block in your content region :-)

It is maybe not that easy as write a few lines of PHP code but it is higly sufficient solution even for non-programmer and it can be also easily modified.


1 - in your node.tpl.php put some condition to check is it that page on which you want to load subcategory
2 - take the taxonomy term name or termid that you will get from the $node variable
3 - call this function and pass proper argument taxonomy_get_children($tid, $vid = 0, $key = 'tid')

I hope it will work

0

精彩评论

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