We talk about how to generate a taxonomy term selection list in the following post.
Drupal 7 – Create a taxonomy term selection list of a specific vocabulary @ 1
Next: Drupal 7 – Create a taxonomy term selection list of a specific vocabulary @ 2
I want to create a HTML selection list which contains the taxonomy terms of a vocabulary. When a option is selected, the browser will go to the selected term page. In this post, i would like to share how to generate a selection list by PHP.
I have a vocabulary which has terms in 2-level. The selection list could generated as follow.
Taxonomy is a must have tool for grouping relevant content together. On the other hand, with the help of Views and exposed filter, user could easily list out the content with specific taxonomy.
Recently i found that there is a module which could turn the multiple levels taxonomy into multiple selection lists. It is called Hierarchical Select written by Wim Leers who is also the author of Drupal CDN module. Let’s try it now.
In Drupal 6, you can get the term object using the following function
About 2 months ago i published a post on how to get the number of nodes of a specific taxonomy term by term ID.
Drupal – Get number of nodes of Taxonomy Term by Term ID
Unfortunately, the taxonomy_term_count_nodes() no longer works in Drupal 7 but you can get the count by Views in D7.
Previously, we talked about how to get the number of nodes of a specific term.
Drupal – Get Number of node of Taxonomy Term by Term ID
How about if i want to get the number of nodes under a specific parent term? Unfortunately, there is no such function. so i try to get that number by SQL. Here is the PHP code.
In Drupal, you can get the number of nodes of a specific term by
<?php print taxonomy_term_count_nodes($term_id); ?>
Reference: StackOverflow – How do I create a node count for each each category term in Drupal?
I found a very good example on retrieving the Vocabulary object by name. Continue reading
Assume we have the following taxonomy hierarchy. Continue reading
The i18n module provides the Taxonomy Translation feature. After you have enabled it, edit the vocabulary which you want to localize and set the Multilingual options to Per language terms.