Skip to content

Replace section like twig#322

Open
RobinDev wants to merge 4 commits intothephpleague:v3from
RobinDev:replaceSection-like-twig-2
Open

Replace section like twig#322
RobinDev wants to merge 4 commits intothephpleague:v3from
RobinDev:replaceSection-like-twig-2

Conversation

@RobinDev
Copy link

  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.

@ragboyjr
Copy link
Contributor

ragboyjr commented Nov 2, 2024

This is interesting, let me think on this for a bit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants