New Raw
<?php
$_rows = array();
//num of columns each row should have
$rows = array(2, 3, 3, 3, 2, 3, 3, 3, 3, 3);
$catIncrement = 0;
foreach($rows as $rowNumber => $numColumns) {
for($i = 0; $i < $numColumns; $i++) {
$catIncrement++;
$_rows['row' . ($rowNumber + 1)][] = 'Category ' . $catIncrement;
}
}
$_containers = array();
//num of rows in each container
$containers = array(1, 3, 1, 5);
$rowIncrement = 0;
foreach($containers as $contNumber => $numRows) {
for($i = 0; $i < $numRows; $i++) {
$rowIncrement++;
$_containers['cont' . ($contNumber + 1)][] = $_rows['row' . $rowIncrement];
}
}
foreach($_containers as $_contKey => $rows):?>
<?php $firstRow = true; ?>
<?php foreach($rows as $rowKey => $categories): ?>
<?php $firstCategory = true; ?>
<?php foreach($categories as $catKey => $category): ?>
<?php //first row -- print open <ul> ?>
<?php if($firstRow): ?>
<?php $firstRow = false; ?>
<?php //if only 2 categories in this row ?>
<?php if(count($categories) == 2): ?>
<ul class="foundry-listing two-up">
<?php else: ?>
<ul class="foundry-listing">
<?php endif; ?>
<?php endif; ?>
<?php //first category in each row ?>
<?php if($firstCategory): ?>
<li class="first"><?php echo $category; ?></li>
<?php $firstCategory = false; ?>
<?php else: ?>
<li><?php echo $category; ?></li>
<?php endif; ?>
<?php endforeach; ?>
<?php endforeach; ?>
</ul>
<?php endforeach; ?>
- Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- New Raw
<ul class="foundry-listing two-up">
<li class="first">Category 1</li>
<li>Category 2</li>
</ul>
<ul class="foundry-listing">
<li class="first">Category 3</li>
<li>Category 4</li>
<li>Category 5</li>
<li class="first">Category 6</li>
<li>Category 7</li>
<li>Category 8</li>
<li class="first">Category 9</li>
<li>Category 10</li>
<li>Category 11</li>
</ul>
<ul class="foundry-listing two-up">
<li class="first">Category 12</li>
<li>Category 13</li>
</ul>
<ul class="foundry-listing">
<li class="first">Category 14</li>
<li>Category 15</li>
<li>Category 16</li>
<li class="first">Category 17</li>
<li>Category 18</li>
<li>Category 19</li>
<li class="first">Category 20</li>
<li>Category 21</li>
<li>Category 22</li>
<li class="first">Category 23</li>
<li>Category 24</li>
<li>Category 25</li>
<li class="first">Category 26</li>
<li>Category 27</li>
<li>Category 28</li>
</ul>
preferences:
294.91 ms | 414 KiB | 391 Q