Answer the question
In order to leave comments, you need to log in
Set up the output of list items in 3 pieces?
There is a task: if the list has more than 3 items, add another list. Now the items are simply displayed all together, tell me how to implement it? js/php doesn't matter.
<ul class="service_list">
<?php foreach($service_list as $row => $list_items): ?>
<li><?php echo $list_items['item']; ?></li>
<?php endforeach; ?>
</ul>
Answer the question
In order to leave comments, you need to log in
<?PHP
$tmp = array_chunk($service_list,3);
foreach($tmp as $k => $v){
echo '<ul class="service_list">';
foreach($v as $row => $list_items)
echo "<li>$list_items[item] </li>";
echo '</ul>';
}
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question