I would like to give thumbnails in a gallery alternating CSS classes.
In other words, I would like to give the first thumbnail the “.mycssclass1”, the second thumbnail “.mycssclass2”, and then repeat in that order, always alternating between the two classes.
Here is the code I am working with:
<?php foreach ($this->getGalleryImages() as $_image): ?>
<li>
<a href="#" onclick="popWin('<?php echo $this->getGalleryUrl($_image) ?>', 'gallery', 'scrollbars=yes,width=300,height=300,resizable=yes');return false;">
<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->directResize(140, 300, 1); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"/>
</a>
</li>
<?php endforeach; ?>
The reason I need such function is to float half of the thumbnails to the left and half to the right.
I really appreciate any help in this.
P.S. Sorry if the title of this post does not make sense, but as I am a layman when it comes to PHP, I did not quite know how to express this problem.