���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/st2/vendor/league/plates/docs/templates/ |
--- layout: default permalink: templates/nesting/ title: Nesting --- Nesting ======= Including another template into the current template is done using the `insert()` function: ~~~ php <?php $this->insert('partials/header') ?> <p>Your content.</p> <?php $this->insert('partials/footer') ?> ~~~ The `insert()` function also works with [folders](/engine/folders/): ~~~ php <?php $this->insert('partials::header') ?> ~~~ ## Alternative syntax The `insert()` function automatically outputs the rendered template. If you prefer to manually output the response, use the `fetch()` function instead: ~~~ php <?=$this->fetch('partials/header')?> ~~~ ## Assign data To assign data (variables) to a nested template, pass them as an array to the `insert()` or `fetch()` functions. This data will then be available as locally scoped variables within the nested template. ~~~ php <?php $this->insert('partials/header', ['name' => 'Jonathan']) ?> <p>Your content.</p> <?php $this->insert('partials/footer') ?> ~~~