/* reset/default variables */
$id = 432; /* resource ID of BannerAds_MtkLib document */

/* select the BannerAds_MtkLib document for get() queries */
$resource = $modx->getObject('modResource', $id);

/* poll the BannerAds_MtkLib document for its first-generation
   children (ie. the individual banner ad documents) */
$bannerAdIDs = $modx->getChildIds($id, 1); /* NB. returns array!! */

/* select each banner ad document in turn for get() queries
   and build html strings in $bannerBuilder array */

foreach ($bannerAdIDs as $key1 => $value1)
{
$resource = $modx->getObject('modResource', $value1);
$bannerBuilder[$key1] = '<br><a href="' . $resource->get('description') . '">';
$bannerBuilder[$key1] .= '<img alt="' . $resource->get('introtext') . '" ';
$bannerBuilder[$key1] .= 'src="' . $resource->get('content') . '" class="imgBannerAd"></a>';
}

/* turn contents of $bannerBuilder array into placeholders for use by
   bannersRotateMtkLib snippet */
$sortedBanners = array(
   'sortedBanner0' => $bannerBuilder[0],
   'sortedBanner1' => $bannerBuilder[1],
   'sortedBanner2' => $bannerBuilder[2],
   'sortedBanner3' => $bannerBuilder[3],
   'sortedBanner4' => $bannerBuilder[4],
   'sortedBanner5' => $bannerBuilder[5],
   'sortedBanner6' => $bannerBuilder[6],
   'sortedBanner7' => $bannerBuilder[7],
   'sortedBanner8' => $bannerBuilder[8],
   'sortedBanner9' => $bannerBuilder[9],
   'sortedBannerLatest' => $bannerBuilder[10]);

$modx->setPlaceholders($sortedBanners);