<?php
// Breadcrumb configuration only - Horizontal nav is now in header.php
$db = & get_instance();
$products = $db->Product_model;
$SiteSetting =$db->Product_model->getSiteSetting();
$page_id = $products->page_id();
$serverReq = checkReq();
require APPPATH."config/breadcrumb.php";
$pageKey = $db->Product_model->page_id();
?>

<!-- Breadcrumbs (only show if they exist) -->
<?php 
if(isset($pageSetting[$pageKey]['breadcrumb']) && count($pageSetting[$pageKey]['breadcrumb']) > 0) { 
?>
<div class="container-fluid">
    <div class="row">
        <div class="col-12">
            <div class="bg-light rounded-3 p-3 mb-4 shadow-sm">
                <div class="d-flex align-items-center">
                    <?php 
                    $count = count($pageSetting[$pageKey]['breadcrumb']) - 1;
                    foreach($pageSetting[$pageKey]['breadcrumb'] as $key => $value) { ?> 
                        <?php if($count == $key) { ?>
                            <?php if($key > 0) { ?>
                                <i class="fas fa-chevron-right text-muted me-2"></i>
                            <?php } ?>
                            <span class="fw-bold text-dark">
                                <?php if($key == 0) { ?><i class="fas fa-home me-1"></i><?php } ?><?= $value['title'] ?>
                            </span>
                        <?php } else { ?>
                            <?php if($key > 0) { ?>
                                <i class="fas fa-chevron-right text-muted me-2"></i>
                            <?php } ?>
                            <a href="<?= $value['link'] ?>" class="text-decoration-none me-2">
                                <?php if($key == 0) { ?><i class="fas fa-home me-1"></i><?php } ?><?= $value['title'] ?>
                            </a>
                        <?php } ?>
                    <?php } ?>
                </div>
            </div>
        </div>
    </div>
</div>
<?php } ?>