Related is a snippet for creating one-to-many and many-to-many relationships between MODx documents in the manager. You basically use it to generate dynamic select menus and checkboxes. It does more than is possible with @SELECT or even @EVAL return $modx->runSnippet(’Ditto’...). For example, you can use ’ultimateParent’ as the value for either the parents parameter or as a tag value to match, and you can specify that child documents inherit their parent’s relationship.
This beta version suports matching documents by one or more tags (tvs),
each with one or more values, eg:
@EVAL return $modx->runSnippet('Related', array("parents"=>"40,24","tags"=>"myTV:value1|value2|value3,anotherTV:value1|value2","inherit"=>"1","noneOption"=>"1"));
I’d appreciate it if people could check it out and do some real world testing.
Also, a few questions:
* should I introduce some AND, OR, NOT style logic to the tag matching?
* should I strip all duplicates, say when the same document matches two tags?
Finally, I’m considering extending this snippet to provide a way to generate dynamic form filters on the front end too - allowing the creation of advanced search forms - essentially a different take on what tvExplorer already does. Is it worth me doing this?
Many thanks
Mark