<?php
foreach ($menu->result() as $mn) {
    $id_menu = $mn->id_menu;
    $wide = $mn->picture;
}
?>

<section class="small-section pt-20 pb-20" style="padding-top: 120px;">
    <div class="container relative">

        <div class="row">
            <div class="desktoponly">

                <?php
                $id_sub['menu_id'] = $id_menu;
                $sub_menu = $this->db->get_where('sub_menu', $id_sub);
                if ($sub_menu->num_rows() == 0) {
                    
                } else if ($sub_menu->num_rows() == 3) {
                    $col = "col-md-4";
                    foreach ($sub_menu->result() as $sbmn) {
                        ?>
                        <div class="col-sm-6 <?= $col ?>">
                            <div class="thumbnail">
                                <!-- Logo Item -->
                                <div class="logo-item" style="text-align: center;">
                                    <a href="<?php echo site_url() ?>pages/sub_produk/<?= $sbmn->key_page ?>/<?= url_title($sbmn->title) ?>" style="text-decoration: none">
                                        <img src="<?php echo base_url() ?>assets/menu/<?= $sbmn->icon ?>" width="67" height="67" alt="" />
                                        <p><?= $sbmn->title ?></p>
                                    </a>
                                </div>

                            </div>
                        </div>
                        <?php
                    }
                } else if ($sub_menu->num_rows() == 4) {
                    $col = "col-md-3";
                    foreach ($sub_menu->result() as $sbmn) {
                        ?>
                        <div class="col-sm-6 <?= $col ?>">
                            <div class="thumbnail">
                                <!-- Logo Item -->
                                <div class="logo-item" style="text-align: center;">
                                    <a href="<?php echo site_url() ?>pages/sub_produk/<?= $sbmn->key_page ?>/<?= url_title($sbmn->title) ?>" style="text-decoration: none">
                                        <img src="<?php echo base_url() ?>assets/menu/<?= $sbmn->icon ?>" width="67" height="67" alt="" />
                                        <p><?= $sbmn->title ?></p>
                                    </a>
                                </div>

                            </div>
                        </div>
                        <?php
                    }
                } else {
                    $col = "col-md-6";
                    foreach ($sub_menu->result() as $sbmn) {
                        ?>
                        <div class="col-sm-6 <?= $col ?>">
                            <div class="thumbnail">
                                <!-- Logo Item -->
                                <div class="logo-item" style="text-align: center;">
                                    <a href="<?php echo site_url() ?>pages/sub_produk/<?= $sbmn->key_page ?>/<?= url_title($sbmn->title) ?>" style="text-decoration: none">
                                        <img src="<?php echo base_url() ?>assets/menu/<?= $sbmn->icon ?>" width="67" height="67" alt="" />
                                        <p><?= $sbmn->title ?></p>
                                    </a>
                                </div>

                            </div>
                        </div>
                        <?php
                    }
                }
                ?>


            </div>
        </div>
    </div>
</section>
<!-- End Logotypes -->

<hr/>

<!-- End Section -->
<section class="page-section" style="padding: 0px;">
    <div class="container relative">
        <div class="local-scroll mb-30 wow fadeInUp" data-wow-duration="1.5s">
            <a href="#top"><img src="<?php echo base_url(); ?>assets/menu/<?= $wide ?>" alt="" /></a>
        </div>
    </div>
</section>


<?php
if ($picture == "" || $picture == null) {
    echo $content;
} else {
    ?>
    <section class="page-section" style="padding: 0px;">
        <div class="container relative">

            <!-- Row -->
            <div class="row">

                <!-- Col -->

                <div class="col-sm-5 mb-40">

                    <div class="local-scroll mb-30 wow fadeInUp" data-wow-duration="1.5s">
                        <a href="#top"><img src="<?php echo base_url(); ?>assets/page/<?= $picture ?>" alt="" /></a>
                    </div>

                </div>

                <!-- End Col -->

                <!-- Col -->

                <div class="col-sm-7 mb-40">

                    <div class="text">
                        <?= $content ?>
                        <hr/>
                        <h5 class="uppercase">Produk Kami :</h5>
                        <div class="mediaku">

                            <?php
                            foreach ($sub_menu->result() as $sbmn) {
                                ?>
                                <div class="col-md-2">
                                    <a href="<?php echo site_url() ?>pages/sub_produk/<?= $sbmn->key_page ?>/<?= url_title($sbmn->title) ?>">
                                        <img src="<?php echo base_url() ?>assets/menu/<?= $sbmn->icon ?>" width="67" height="67" alt="" />
                                    </a>
                                </div>
                                <div class="col-md-10">
                                    <a href="<?php echo site_url() ?>pages/sub_produk/<?= $sbmn->key_page ?>/<?= url_title($sbmn->title) ?>" style="text-decoration: none">
                                        <h4 class="media-heading"><?= $sbmn->title ?></h4>
                                    </a>
                                </div>
                                <?php
                            }
                            ?>



                        </div>





                    </div>

                </div>

                <!-- End Col -->

            </div>
            <!-- End Row -->

            <hr class="mb-40" />
        </div>
    </section>
    <?php
}
?>