Hi all,
I’ve tried really hard with this one, reading and re-reading the documentation and examples, doing 10s of searches on the forums and simplifying my code, all so far to no avail.
I want to use ditto to filter based on 2 clauses with an AND relationship. As I understand it the only way to do this is using extenders. I have created a file called:
directors.extender.inc.php
which contains the following code:
<?php
echo "test in extender";
$filters["custom"]["directorsFilter"] = array("projectElementShowInDirectorList,projectElementDirector","directorsFilter");
if (!function_exists("directorsFilter")) {
function directorsFilter($resource) {
echo "test in function";
if ($resource['projectElementShowInDirectorList'] == "yes" && $resource['projectElementDirector'] != "") {
return 0;
} else {
return 1;
}
}
}
?>
Here is my ditto call:
[!Ditto?parents=`2`&hideFolders=`1`&depth=`2`&sortBy=`menuindex`&sortDir=`ASC`&display=`all`&extenders=`directors`&tpl=`mychunk`&debug=`1`!]
Notice the two echo calls. The first one that echos "test in extender" is echoed to screen so I know that the extender is being loaded. The second one that echos "test in function" does not appear, telling me that the function never gets called.
I’m wondering if there is something else in my ditto call that prevents the custom filter being called. I’ve played around with other parameters but nothing gives me the results I expect, I always get all the data.
projectElementShowInDirectorList is a checkbox tv with a input value of ’yes’ and a default value of ’no’.
projectElementDirector is a dropdown tv and contains a string value.
I am using ditto version 2.0.2 and modx version 0.9.6.1 and php version 5.2
Any help or work-a-rounds would be very appreciated