home-icon
Get section content
Last updated: Mar 28, 2024

Introduction

This function is used in practically every Webigniter website. It is used to include all sections attached to the current page. Usually you will call this function within your layout file.

Usage

When in your layout file, place the following snippet on the location where you want to include your section files.

<?php $webigniter->getSectionsContent(); ?>

This will include all attached sections on this page on this location in the code.

If you need to, you can add your own data as well, to be passed to your section files.

<?php

$extraData = [
   'first_name' => 'John',
   'last_name' => 'Doe'
];

$webigniter->getSectionsContent($extraData);
 ?>

You see you can create a php array and pass it to the getSectionsContent() function. Now you can use the variables $first_name and $last_name in any of the included sections. And they will hold the names 'John' and 'Doe'.

Table of Contents
  1. Introduction
  2. Usage