I have a template that lists out elements in a foreach:
<?php $currentCategory = $this->getCurrentCategory();?>
<?php $childrenCategories = $this->getChildrenCategoriesCollection($currentCategory);?>
<div class="subcategory-wrap">
    <ul class="subcategory-list">
        <?php ?>
        <?php foreach ($childrenCategories as $cc): ?>
            <li class="subcategory-item">
                <a class ="subcategory-image-link"href="<?php echo $cc->getUrl() ?>"><img src="<?php echo $cc->getImageUrl() ?>" class="subcategory-image" /></a>
                <span class="subcategory-title"><a href="<?php echo $cc->getUrl() ?>"><?php echo $cc->getName() ?></a></span>
            </li>
        <?php endforeach; ?>
    </ul>
</div>
What I'm trying to do is list them out alphabetically based off of their name $cc->getName().  What I'm having trouble with is associating the appropriate images with their names.
 
    