PHP code example of kros / plates-sections-insertion

1. Go to this page and download the library: Download kros/plates-sections-insertion library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kros / plates-sections-insertion example snippets


<html>
<body>
<div id='div_header'><?= $this->section('up_section') 

 $this->layout('template.php'); 

Hello <?= $name 

Goodbye


eague\Plates\Engine;
use Kros\PlatesSectionsInsertion\SectionsInsertion;
  
$engine = new Engine('route/to/templates');
$engine->loadExtension(new SectionsInsertion());

$t = $engine->make('othertemplate'); /* make the template
$t->setSectionContent('up_section', 'welcome', ['name'=>'John Doe']); // set content for 'header_section' section (with params)
$t->setSectionContent('bottom_section', 'bybye'); // set content for 'bottom_section' (without params)
echo $t->render(); // finally render the template
  

...
$t->pushSectionContent('up_section', 'welcome', ['name'=>'Mary May']); // push the new content for 'up_section' section behind the actual content.
$t->unshiftSectionContent('bottom_section', 'bybye'); // unshift the new content for 'bottom_section' section before the actual content.