Hi All
I’ve been searching in the forum for some time now and found a solution to my problem
So, after applying the solution it didn’t work - so again after researching further I found another solution but that doesn’t work properly either (with my setup).
I am trying to get the "Ditto Extender: countDocs" to work whilst using the "Phx Plugin" at the same time.
When Phx is disabled the extender works perfectly - but yes, as soon as its activated all goes to the dogs.
The following is the output from Ditto when Phx is activated:
&tpl either does not contain any placeholders or is an invalid name, code block, or filename. Please check it.
If anyone has an idea to solve this problem, that would be great.
My Ditto call:
[[Ditto? &extenders=`countDocs` &display=`1` &parents=`3,4` &depth=`2` &tpl=`@CODE Total Documents: [+count+]` &hideFolders=`1` &showInMenuOnly=`0` &showPublishedOnly=`1`]]
Ditto Extender:
<?php
/*
* Ditto Extender: countDocs
* Counts documents returned by Ditto
* Copyright (c) 2009-2010 Aleksander Maksymiuk, http://setpro.net.pl/
* Parameters:
* no parameters required
* Example: count documents within 3, 4, and 5 containers
* [[Ditto? &parents=`3,4,5` &extenders=`countDocs` &display=`1` &tpl=`@CODE:[+count+]`]]
* Please notice in the above example 'display' parameter set to 1 -> it was done
* because 'count' placeholder is set to each document within result set while we (most likely)
* need this value to be returned only once
*/
$GLOBALS['docCounter'] = 0;
$filters['custom']['countDocs'] = array('id', 'countDocuments');
if (!function_exists('countDocuments')) {
function countDocuments($resource) {
# count documents
$GLOBALS['docCounter']++;
return 1;
}
}
$placeholders['count'] = array('id', 'setCountPlaceholder');
if (!function_exists('setCountPlaceholder')) {
function setCountPlaceholder($resource) {
return $GLOBALS['docCounter'];
}
}
?>