One of the first (and admittedly only) things I learned when I first started making my limited little ASP-based CMS functions back in the day was how to add fields to my CMS input forms (and the corresponding columns to the database) to allow rows in the table to include tags, or categories or other yes/no questions. For instance, in a table of "employees", a yes/no field called "published" would be a column in a row that would be used as a filter when writing my SQL query. Easy peasy. Another column would capture their favorite ice cream topping(s) from any or all of a list of three: caramel, fudge and/or strawberries. We could then use those values as well as a filter in a SQL query.
So in MODX, let's say I've used MIGX to create a little function (a TV called "employeeList") to capture employees the same way:
1) name (textbox)
2) title (textbox)
3) bio (richtext)
4) toppings (checkbox: caramel, fudge, strawberries)
5) published (checked or unchecked)
I assume that "published" would have a "1" as its value if checked.
Dessert toppings might look like "caramel" or "fudge" or "caramel,strawberries" depending on what checkbox(es) are checked.
--------------
Now I want to list all the employees that are published and like fudge. I assume I could do it like so:
[[!getImageList?
&tvname=`employeeList`
&where=`{"published:=":"1"}`
&where=`{"toppings:=":"fudge"}`
&tpl=`employees.RowTpl`]]
But this only works to return the employees that ONLY clicked "fudge". If an employee liked fudge AND strawberries, the value would be stored as "fudge,strawberries" and &where=`{"toppings:=":"fudge"}` wouldn't return that employee.
How would I accomplish this?
The reason I see this as having great value is anywhere you want to be able to use the same "row" of content in more than one place, based on some recorded criteria. Like categories in WordPress. Some employees might be proficient in multiple skills, and you want to be able to sort them or filter them on the front-end by a particular skill. Or show all of the employees with one skill on one page of the site and the employees with another skill on another page of the site, and those sets will overlap. Likewise, a site's press releases might be included in more than one category, and those need to be shown in more than one place. Or an image gallery would have items that fell into multiple categories, each of which might need to be filtered to result in a set of only photos that have kids, or only those with dogs, or only those with kids AND dogs or only those of sunsets.
you cannot use multiple properties with the same name, but you can try:
[[!getImageList?
&tvname=`employeeList`
&where=`{"published:=":"1","toppings:=":"fudge"}`
&tpl=`employees.RowTpl`]]
but if you really need much different filtering and sorting, I think you should put them into a custom-table and use MIGXdb instaed.
See this Tutorials to get the idea:
http://rtfm.modx.com/extras/revo/migxdb/migxdb.tutorials