Ok...got a small problem I’m trying to work out with a snippet I’m developing. I’m making use of the getDocumentChildrenTVarOutput call to include the pagename, id, and template variable for a range of pages. This particular snippet will be used to show a list of pages that belong to a specific category based on a provided template variable. However, the problem I’m having is finding an easy way to filter the returned getDocumentChildrenTVarOutput with just the pages that equal a certain value in the template variable. For example, let’s take the following code:
$result = $modx->getDocumentChildrenTVarOutput($rootFolder,array("id","pagetitle","MyTVvar"),1,$order);
The MyTVvar is just an example, but assume that the values of this array are numbers representing a specific category. Now, let’s say we only want pages where the MyTVvar equals 2....what’s the easiest way to filter out the $result array to where it only contains pages where the MyTVvar equals 2? That’s the problem. I’ve looked into the user of the array_filter function...but I’m not sure if it’s the right thing to use in this case. Any ideas?
I’m almost beginning to think that maybe a small addition to these functions is necessary. Perhaps a change in the getDocumentChildrenTVarOutput and similar functions that allows for filtering might be handy.