I'm trying to create two unordered lists from a PHP array, I found this thread which is pretty much what I'm looking for, but I would like the first list to have 11 items, the second list to have the rest. Here's my code:
<?php if ($rows) :
$items = count($rows);
$split = ceil($items/2);
$firsthalf = array_slice($rows,$split);
$secondhalf = array_slice($rows,0,$split);
?>
<div class="tickets">
<div class="col1">
<ul>
<?php foreach ($firsthalf as $item) : ?>
<li><a href="">test 1</a></li>
<?php endforeach; ?>
</ul>
</div>
<div class="col2">
<ul>
<?php foreach ($secondhalf as $item) : ?>
<li><a href="">test 2</a></li>
<?php endforeach; ?>
</ul>
</div>
<div class="clear"></div>
</div>
<?php endif; ?>
shuffle
the array before you do yourarray_slice
ing. – sberry Jan 20 at 23:28