<?php
// Site Builder v2025 category.php
include "includes/functions.php";
include "includes/env_setup.php";
include "includes/template_category_setup.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php include "includes/template_meta.php";?>
<?php include "includes/template_header.php"; ?>
</head>
<body class="<?= $customTheme ?><?= $min_content ? ' mc' : '' ?>">
<?php include "includes/template_top.php"; ?>
<main id="main">
        <section>
            <div class="container">
                <div class="row">
                    <div class="col-md-9" data-aos="fade-up">
                        <h3 class="category-title">Category: ><?php echo str_replace('-', ' ', ($category_id ?? 'All')); ?></h3>
                        <?php
                        //cat layout - Include the correct category layout based on $CatLayout
                        $template_file = "includes/template_category_catlayout_" . $CatLayout . ".php";
                        if (file_exists($template_file)) {
                            include $template_file;
                        } else {
                            echo "Error: Layout file not found.";
                        }  
                        ?>
                        <?php //cat layout pagination
                        include "includes/template_category_pagination.php";
                        ?>
                    </div>

                    <div class="col-md-3">
                        <?php //side bar
                        include "includes/template_sidebar.php" ?>
                    </div>
                </div>
            </div>
        </section>
    </main>
    <?php include "includes/template_footer.php"; ?>
</body>
</html>
