Created
June 13, 2013 10:56
-
-
Save yratof/5772886 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$classes = array(' first', '' , '', ' last'); | |
if ($categories) { ?> | |
<div class="category-list"> | |
<?php if (count($categories) <= 4) { ?> | |
<ul class="categoryRow twelvecol clearfix first"> | |
<?php foreach ($categories as $category) { ?> | |
<li class="threecol clearfix first img"> | |
<?php if ($category['thumb']) { ?> | |
<a href="<?php echo $category['href']; ?>"><img src="<?php echo $category['thumb']; ?>" alt="<?php echo $category['name']; ?>" /></a> | |
<?php } ?> | |
<a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></li> | |
<?php } ?> | |
</ul> | |
<?php } else { ?> | |
<?php for ($i = 0; $i < count($categories);) { ?> | |
<ul class="categoryRow twelvecol clearfix first"> | |
<?php $j = $i + 4; ?> | |
<?php for (; $i < $j; $i++) { ?> | |
<?php if (isset($categories[$i])) { ?> | |
<li class="threecol clearfix img <?php echo $classes[4 - ($j - $i)]; ?>"> | |
<a href="<?php echo $categories[$i]['href']; ?>"> | |
<?php if ($categories[$i]['thumb']) { ?> | |
<img src="<?php echo $categories[$i]['thumb']; ?>" alt="<?php echo $categories[$i]['name']; ?>" /> | |
<?php } ?> | |
<?php echo $categories[$i]['name']; ?> | |
</a> | |
</li> | |
<?php } ?> | |
<?php } ?> | |
</ul> | |
<?php } ?> | |
<?php } ?> | |
</div> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment