OK, I’m not sure why but initially it didn’t want to work, does now though
<?php
// ------------------------
// Snippet: hasChildren
// ------------------------
//
[email protected]
//
// Thanks to ListChildOrSibs by
[email protected] for giving me a basic understanding
// of how to accompish this
// A simple snippet (my first) to check whether the current document has children
// I created it for use with a sub navigation. If the document has children
// I call a chunk that contains [!Wayfinder!] otherwise I output a HTML chunk
// that contains something else...in my case the most recent blog entry
// Installation:
// Go to Resource => Manage Resources => Snippets & select "New Snippet"
// Paste the contents of this txt file into it and save
// Call it like
// [[hasChildren? &noChildChunk=`noKidsChunk`&childChunk=`foundKidsChunk`]]
// The chunks you define in this call omit the {{ and }}...I add them in the code
// for the main resaon that it wouldn’t work otherwise
// In it’s simplest form you can call [[hasChildren]] which will return a string
// ’Document has no children’ or ’This document has children’ depending.
//Check if Chunks were assigned as parameters when the snippet was called
//If not pass it a value of ’empty’
$noChildChunk = isset($noChildChunk) ? $noChildChunk:’empty’;
$childChunk = isset($childChunk) ? $childChunk:’empty’;
//If parameters weren’t passed then output a string telling the user
//whether the current document has children or not
if($noChildChunk==’empty’){
$none = ’Document has no children’;
}else{
$none=$modx->getChunk($noChildChunk);
}
if($childChunk==’empty’){
$some = ’This document has children’;
}else{
$some=$modx->getChunk($childChunk);
}
//Find children
// This line taken from the ListChildOrSibs by
[email protected]
// so its probably the only one that is correct

$children = $modx->getDocumentChildren($modx->documentIdentifier,1,0,’hidemenu’, ’hidemenu=0’);
// If there are no children for the current page output negative
if (!$children){
$hc_Output=$none;
}else{
//otherwise output positive
$hc_Output = $some;
}
// end if children exist
// send to parser
return $hc_Output;
?>
I submitted it to the resources too.
http://modxcms.com/hasChildren-0.2-1457.html
Think I will have to brush up on my PHP a little.
Thanks,
Taff