Taxonomies are one of many powerful database features built into the Webvanta system, but until now, they have been quite limited. We've recently given them a big boost with an assortment of new features, and there's more to come.
A taxonomy is just a list of names, and until now its primary use has been to generate select lists for custom item types. For example, if you wanted to have a pop-up list of all the U.S. states for a "State" field, you can create a taxonomy with the names of all the states, and then reference that taxonomy in your custom item type.
We've added a variety of new features that make taxonomies more broadly useful:
- You can now create a hierarchical taxonomy (like categories and subcategories), and a tree-type picker will automatically be used in the form for entering items for your custom item type.
- For "flat" taxonomies (a list of terms, without hierarchy), you can choose to either list all the terms in the form with check boxes, or to have a text field.
- If you use the text field to enter taxonomy terms, then you can enter multiple terms at once, separated by commas. Autocomplete will suggest terms as you type, once you've entered the first few letters. And if you enter a term that does not already exist in the taxonomy, it will be automatically created for you.
- You can loop through all the values of a taxonomy using WebvantaScript.
Choosing the Taxonomy Term Entry Method
By default, the taxonomy picker in a custom item type form will use the list of terms and checkboxes. If you want the new behavior, showing a text entry field and allowing you to enter a comma-delimited list and create terms on the fly, add an exclamation point after the taxonomy name in the Type Options field when you are defining the custom item type.
Iterating Through Taxonomy Terms with WebvantaScript
If you want to display a list of all the terms in a taxonomy, you can easily do so, as follows:
<ul> <w:taxonomy:each name="animals" sort="name"> <li><w:name /></li> </w:taxonomy:each> </ul>