0

I am trying to find a simple way to split the following array into a number of columns, instead of one very long list. I don't want to use tables to chunk it up, so I need to split into a variable number of UL's. Magento seems to be very picky and I have not been able accomplish this. I appreciate any suggestions.

<div class="category-grid">

<?php $_columnCount; ?>

<ul>
<?php if($i++%$_columnCount==0): ?>
<?php foreach ($this->getCurrentCategory()->getChildrenCategories() as $_subcat): ?>

<li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0):?> last<?php endif; ?>">
<a href="<?php echo $_subcat->getUrl() ?>">
<div class="category-data"><?php echo Mage::helper('catalog/output')->categoryAttribute($_subcat, $_subcat->getName()) ?></div>
</a>
</li>

<?php endforeach ?>
</ul>

bstone
  • 9
  • 4
  • The 'duplicate' I've highlighted is very similar. If what you're after is different, feel free to say why and I'll remove the flag. – Adrian Wragg Jan 15 '16 at 15:15
  • Thank you Adrian! I was hoping to find a way to do it using php, that doesn't cause Magento to throw an error. But this solution works and doesn't cause errors. – bstone Jan 15 '16 at 18:33

0 Answers0