Welcome Guest, Not a member yet? Register   Sign In
View layout with two successive includes
#1

Hello,

I am currently working on a project based on CI4 and have now reached the layout. For this I would like to use the flexible View Layout System from CI, but I think I just found an error.

I use the following code to build the layout in a view:
PHP Code:
<?= $this->extend('layouts/main'?>
<?= $this
->include('includes/topbar'?>
<?= $this
->include('includes/sidebar'?>


The layout looks like this:

PHP Code:
<!DOCTYPE html>
<
html lang="en">

<
head>
<
title><?= env('app.site.title'?> - <?= $this->data['title'?></title>
</head>

<body id="page-top">

<!-- Page Wrapper -->
<div id="wrapper">
    <?= $this->renderSection('sidebar'?>

    <!-- Content Wrapper -->
    <div id="content-wrapper" class="d-flex flex-column">

        <!-- Main Content -->
        <div id="content">

            <?= $this->renderSection('topbar'?>
        </div>
    </div>
</div>
</body>
</html> 

In the respective Includes I assemble the Sections.
PHP Code:
<?= $this->section('sidebar'?>
<!-- Sidebar -->
<!-- End of Sidebar -->
<?= $this->endSection() ?>

PHP Code:
<?= $this->section('topbar'?>
<!-- Topbar -->
<!-- End of Topbar -->
<?= $this->endSection() ?>

Now I have the problem that I only get the first include of both, but never both at the same time. Does anyone know this problem or have a solution for it?
Reply


Messages In This Thread
View layout with two successive includes - by elyday - 01-09-2020, 08:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB