How do I programmatically generate a menu based on field values? I'm working on a site where I want to have a menu that displays links based off of the content of a certain field.

For example, lets say it is int field_apples. I want to automatically generate a menu that will have links to lists of articles with each value of apples (or a range of apples such as ≤9 apples).


Apples menu

1 apple
2 apples
3 apples
7 apples
9 or more apples



Each link above will show a list of articles for that particular value of apples.
This could be achieved by using taxonomy to define your terms and the Taxonomy Menu module to create the menu from these terms. Taxonomy is the preferred method for categorising content.