Here's an enhancement that will also test isfolder at the same time:
<?php
/*GetLevel snippet */
$parentIds = $modx->getParentIds($modx->resource->get('id'))
$count = count($parentIds);
return $modx->resource->get('isfolder')? $count : '';
If it's not a folder, the snippet with return nothing. If it is, it will return the level.
Note that unlike Evolution, a non-folder can have children and a folder can have no children.
If you want to test whether it has children (rather than the isfolder setting), change the last line to:
return $modx->resource->hasChildren()? $count : '';
BTW, I would put the desired output in the snippet as well for speed or use $modx->getChunk() to pull it in from a chunk.