@charliez, @ChuckTrukk
Simple example:
* Create folders in the site tree with your two sets of items, eg ’Departments’ and ’People’
* Create a ’person’ template and a ’department’ template
* Fill the ’Department’ folder and the ’People’ folder with documents based on the appropriate template
* Create a new TV called ’department’:
- Input Type: use Check Box (can also be DropDown List Menu or Listbox)
- Input Option Values:
@EVAL return $modx->runSnippet('Quill', array("parent"=>"4"));
(replace the ’4’ with the actual document id of the ’Department’ folder)
- Delimiter: ,
- Assign the TV to the People template
* Now you will have a checkbox for each department on pages based on the ’Person’ template
So you will now be able to assign each ’person’ to one or more ’departments’.
How to output the relationships on your website frontend? Use a Ditto tagging call. For example, to list people in a particular department in the department template add:
[!Ditto? &parents=`40` &depth=`1` &display=`all` &tagData=`department` &tagMode=`onlyTags` &tagDelimiter=`,` &tags=`*id*` &sortBy=`pagetitle` &sortDir=`ASC` &tpl=`deptTpl`!]
(where ’40’ is the id of the ’people’ document folder).