Hi everybody,
Sorry, I have another question ...
I can easily count how many results I get a call to ditto? Or better a quick way to get the number of children of a resource .. I assume with a snippet?!
can someone help me please?
thx
[ed. note: fabryshock last edited this post 15 years ago.]
"Destiny is not a matter of chance, it's a matter of choice"
i have found a snippet, but did'nt work in Evo:
getChildCount:
<?php
$count = 0;
$parent = isset($parent) ? (integer) $parent : 0;
if ($parent > 0) {
$criteria = array(
'parent' => $parent,
'deleted' => false,
'published' => true,
);
$count = $modx->getCount('modResource', $criteria);
}
return (string) $count;
?>
someone can tell me how to change it for Evo?
many thx
"Destiny is not a matter of chance, it's a matter of choice"
In Evo appear this error when i try the snippet:
Fatal error: Call to undefined method DocumentParser::getCount() in /var/www/isola/manager/includes/document.parser.class.inc.php(814) : eval()'d code on line 10
"Destiny is not a matter of chance, it's a matter of choice"
<?php
/*
usage
[ !snippet? &parent=`XX`! ] or [ !snippet! ]
*/
$parent = isset($parent) ? (integer)$parent : $modx->documentObject['id'];
$child_count = $modx->db->getRecordCount( $modx->db->select( 'id',$modx->getFullTableName('site_content'), 'parent="'.$parent.'" AND published="1"' ) );
$output = $child_count !='' ? $child_count : '';
return $output;
?>
Hi,
many thx at all!!
the snippet of breezer work great!!
"Destiny is not a matter of chance, it's a matter of choice"