<?php
if(hasAccess()){
    $pageinfo = getContent();
    //print_r($pageinfo);
?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <div class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1 class="m-0"><?php $counted=count($pageinfo);echo $pageinfo[$counted-1]['menuname']?></h1>
                </div><!-- /.col -->
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-right">
                        <?php
                        for($i=0;$i<count($pageinfo);$i++){
                            $active = ($i+1==count($pageinfo))?'active':'';
                            echo "<li class=\"breadcrumb-item {$active}\"><a href=\"{$pageinfo[$i]['menuurl']}\">{$pageinfo[$i]['menuname']}</a></li>";
                        }
                        ?>
                    </ol>
                </div><!-- /.col -->
            </div><!-- /.row -->
        </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->

    <!-- Main content -->
    <section class="content">
        <?php
            //print_r($pageinfo);
            $templateToLoad = getTemplate();
            if(file_exists($templateToLoad)){
                require_once($templateToLoad);
            }else{
                echo "Failed to load! Expected to load:{$templateToLoad}";
            }
        ?>
        <div class="container-fluid">
        </div>
    </section>
</div>
<?php
}
?>