You can display the IDs by using the following placeholder in the template:
There's no way I know of, however, for you to "get" them from pdoResources because all it returns is a big bunch of HTML. You could insert something like this in your Tpl chunk:
Then you could use regular expressions on $page to find them, save the id, and remove the tags.
Since you're rolling your own PHP, you could also get them this way:
$ids = $modx->getChildIds($parent,0);
That will give you an array containing the IDs of all the resources, even those that are deleted or unpublished. Unfortunately, getChildIds() doesn't have the option to filter resources except by context.
To filter those, you'd have to do something like this:
$allIds = array();
foreach($ids as $id) {
$doc = $modx->getObject('modResource', $id);
if ($doc->get('published') && (! $doc->get('deleted'))) {
$allIds[] = $id;
}
}
This would be fairly slow. There are faster ways to do it, but they would require more complex code.