I have some HTML formatting on my front end template that depends on the result of a foreach loop on an array, in this example in order to get the right formatting it expects the order of the panel_type_id to be 4,6,3 otherwise it builds the formatting wrong.
If the panels are added in the order of 4,6,3 then there's no problem.
Is there a way to reorder the array on load so that no matter what it follows this order?
<div class="row middle">
<?php foreach($panelResult as $PR): ?>
<?php if($PR['panel_type_id'] == 4){ ?>
<!-- Left -->
<div class="col-lg-6" >
<div class="row" style="height:50%; padding-bottom: 15px;">
<div class="col-lg-12" style="height:100%;">
<div style="/*background-color: rgba(255, 255, 255, 0.5);*/ height: 100%; ">
<?php echo $PR['content']?>
</div>
</div>
</div>
<?php } elseif($PR['panel_type_id'] == 6){?>
<div class="row" style="height:50%; padding-top: 15px;">
<div class="col-lg-12" style="height:100%;">
<div style="/*background-color: rgba(255, 255, 255, 0.5);*/ height: 100%;">
<?php echo $PR['content']?>
</div>
</div>
</div>
</div>
<?php } elseif($PR['panel_type_id'] == 3){?>
<div class="col-lg-6" >
<div style="/*background-color: rgba(255, 255, 255, 0.5);*/ height: 100%; ">
<?php echo $PR['content']?>
</div>
</div>
<?php } ?>
<?php endforeach; ?>
</div><!--end row middle-->