Imagine de following file structure.
One layout.phtml:
<html>
<head>
<title>Document</title>
<?php $this->section('custom-head') ?>
</head>
<body>
<?php $this->content() ?>
<?= $this->section('custom-footer', $this->fetch('footer-default')) ?>
</body>
</html>
One details.phtml page:
<?php $this->layout('layout.phtml') ?>
<h1>My Details page</h1>
<?php foreach ($items as $item) ?>
<?= $this->fetch('item.phtml', ['item' => $item]) ?>
<?php endforeach ?>
One item.phtml page:
<?php $this->push('custom-head') ?>
<script>
globalApiHelper.sendUserRenderedDetailsItem(itemPrice);
</script>
<?php $this->end() ?>
<h2>My item <?= $item->name ?></h1>
And finally
<?php
$renderedView = $platesEngine->render('details.phtml', ['items' => $items]);
echo $renderedView;
The push inside the fetched template (item.phtml) will never appear in the final $renderedView string.
Imagine de following file structure.
One
layout.phtml:<html> <head> <title>Document</title> <?php $this->section('custom-head') ?> </head> <body> <?php $this->content() ?> <?= $this->section('custom-footer', $this->fetch('footer-default')) ?> </body> </html>One
details.phtmlpage:One
item.phtmlpage:And finally
The push inside the fetched template (
item.phtml) will never appear in the final$renderedViewstring.