thephpleague / plates

Native PHP template system
https://platesphp.com
MIT License
1.47k stars 180 forks source link

Replace section like twig #322

Open RobinDev opened 10 months ago

RobinDev commented 10 months ago
  1. NO Bc Break

  2. Be able to have multiple children rendering the same section. Eg :

Actually

<!-- file1.php -->
<?= $this->section('exampleSection') ?>
<?php $this->layout('file1.php') ?>
<!-- file2.php -->
<?= $this->start('exampleSection'))  ?>
<?php sleep(12) ?>
<?php $this->stop() ?>
<?php $this->layout('file2.php') ?>
<!-- file3.php -->
<?= $this->start('exampleSection')) ?>
<?php sleep(8) ?>
<?php $this->stop() ?>

If i render file3.php, i will wait 12 + 8 seconds.

With this fork

<!-- file1.php -->
<?= $this->section('exampleSection') ?>
<!-- file2.php -->
<?= if ($this->start('exampleSection')) { ?>
<?php sleep(12) ?>
<?php } $this->stop() ?>
<!-- file3.php -->
<?= if ($this->start('exampleSection')) { ?>
<?php sleep(8) ?>
<?php } $this->stop() ?>

If i render file3.php, i will wait 8 seconds.

Hope I am enough clear.