<?php
$_rows = array();
$_sub_categories = array();
for($i = 1; $i <= 28; $i++) {
if(in_array($i, array(1,2))) {
$_rows['row1'][] = 'Category '.$i;
}
if(in_array($i, array(3,4,5))) {
$_rows['row2'][] = 'Category '.$i;
}
if(in_array($i, array(6,7,8))) {
$_rows['row3'][] = 'Category '.$i;
}
if(in_array($i, array(9,10,11))) {
$_rows['row4'][] = 'Category '.$i;
}
if(in_array($i, array(12,13))) {
$_rows['row5'][] = 'Category '.$i;
}
if(in_array($i, array(14,15,16))) {
$_rows['row6'][] = 'Category '.$i;
}
if(in_array($i, array(17,18,19))) {
$_rows['row7'][] = 'Category '.$i;
}
if(in_array($i, array(20,21,22))) {
$_rows['row8'][] = 'Category '.$i;
}
if(in_array($i, array(23,24,25))) {
$_rows['row9'][] = 'Category '.$i;
}
if(in_array($i, array(26,27,28))) {
$_rows['row10'][] = 'Category '.$i;
}
}
foreach($_rows as $key => $val) {
if(in_array($key, array('row1'))) {
$_sub_categories[1][] = $val;
}
if(in_array($key, array('row2','row3','row4'))) {
$_sub_categories[2][] = $val;
}
if(in_array($key, array('row5'))) {
$_sub_categories[3][] = $val;
}
if(in_array($key, array('row6','row7','row8','row9','row10'))) {
$_sub_categories[4][] = $val;
}
}
print_r($_sub_categories);
foreach($_sub_categories as $_subcats):?>
<?php echo key($_subcats); ?>
<ul class="foundry-listing">
<?php foreach($_subcats as $_subcat) : ?>
<?php $j = 0; ?>
<?php foreach($_subcat as $_sub_category): $j++; ?>
<li <?php if($j==1) { echo 'class="first"'; } ?>><?php echo $_sub_category; ?></li>
<?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.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 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.30, 8.2.0 - 8.2.24, 8.3.0 - 8.3.12
- Array
(
[1] => Array
(
[0] => Array
(
[0] => Category 1
[1] => Category 2
)
)
[2] => Array
(
[0] => Array
(
[0] => Category 3
[1] => Category 4
[2] => Category 5
)
[1] => Array
(
[0] => Category 6
[1] => Category 7
[2] => Category 8
)
[2] => Array
(
[0] => Category 9
[1] => Category 10
[2] => Category 11
)
)
[3] => Array
(
[0] => Array
(
[0] => Category 12
[1] => Category 13
)
)
[4] => Array
(
[0] => Array
(
[0] => Category 14
[1] => Category 15
[2] => Category 16
)
[1] => Array
(
[0] => Category 17
[1] => Category 18
[2] => Category 19
)
[2] => Array
(
[0] => Category 20
[1] => Category 21
[2] => Category 22
)
[3] => Array
(
[0] => Category 23
[1] => Category 24
[2] => Category 25
)
[4] => Array
(
[0] => Category 26
[1] => Category 27
[2] => Category 28
)
)
)
0<ul class="foundry-listing">
<li class="first">Category 1</li>
<li >Category 2</li>
</ul>
0<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>
0<ul class="foundry-listing">
<li class="first">Category 12</li>
<li >Category 13</li>
</ul>
0<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:
113.83 ms | 421 KiB | 5 Q