@chaley: I am having a little problem with the for loop, relating to a new template function I've added to the plugin. The function is called category_items(). It works as follows
Code:
program:
category_items('#genre')
This would return all the #genre tags.
It can also take second optional arg to limit the result to set of book_ids
Code:
program:
book_ids = from_selection('id');
category_items('#genre',book_ids)
from_selection() can be replaced with from_search() to achieve the same result. I've updated both to accept 'id' as column name and return a list of book_ids.
The problem arise when I run the new function on a field containing names like 'authors'. I have to return a list separated with an ampersand, because author names can have commas in them. The documentation says the for loop will only accept a comma separated list of values. Can this modified to allow the user to somehow choose a different separator, maybe by setting a variable before running the for loop.
Another thing: I started making another function top_category_items() that is the same to the above function, but only extracts the top hierarchy level. I then starting having doubt, because I thought maybe combining the category_items() with subitem() would be a better way to achieve this and also offers more possibilities. The problem here is with that approach, I have to remove duplicates myself. It can be done using template but a lot of hassle. I ran recently into this problem in
this template. The solution would be to add a uniq() template that removes duplicates from a list. I can easily add this, but I think it might be better to be included in the template builtin functions. Would you be willing to add something like this? I not, I will add to the plugin.