samedi 25 avril 2015

Create 3rd level foreach and loop the arrays and save it to data?


I am using opencart 1.5.6.4 . I've create a module.

<?php $module_row = 1; ?>
<?php foreach ($modules as $module) { ?>

<?php $element = 1; ?>
<?php if(isset($module['tabs'])) { foreach($module['tabs'] as $tab) { ?>

<?php $elements = 1; ?>
<?php if(isset($tab['styles'])) { foreach($tab['styles'] as $style) {  ?>

<?php $elements++; } }  ?>

<?php $element++; }  } ?>

<?php $module_row++; } ?>

But 3rd level not working and saved.

<?php $elements = 1; ?>
    <?php if(isset($tab['styles'])) { foreach($tab['styles'] as $style) {  ?>

When i changed it to

<?php $elements = 1; ?>
        <?php foreach($tab as $style) { if ($style > 0) {  ?>

Not working properly.

What is the correct solution?


Aucun commentaire:

Enregistrer un commentaire