Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nested inheritance #8

Closed
mindyk opened this issue Feb 21, 2014 · 2 comments
Closed

nested inheritance #8

mindyk opened this issue Feb 21, 2014 · 2 comments

Comments

@mindyk
Copy link

mindyk commented Feb 21, 2014

is this possible / intented, i am trying right now and get a blank page without erros )- :

<!-- index -->
<?= $this->content ?>
<!-- AAA -->
<?php $this->layout('index') ?>
<?php $this->start('content') ?>
<h1>CONTENT</h1>
<?= $this->subcontent ?>
<?php $this->end();
<!-- BBB -->
<?php $this->layout('AAA') ?>
<?php $this->start('subcontent') ?>
<h2>SUBCONTENT</h2>
<?php $this->end(); ?>

expected output

<!-- index -->
<h1>CONTENT</h1>
<h2>SUBCONTENT</h2>
@reinink
Copy link
Contributor

reinink commented Feb 22, 2014

You cannot define "sub layouts". In fact, if you set a layout using the $this->layout() method in a nested template it will actually overwrite the layout defined by it's parent.

Here is how I would tackle what your trying to do. In this situation aaa is your template, index is the layout, and bbb is the nested template.

<!-- index -->
<?=$this->content?>
<?=$this->subcontent?>
<!-- AAA -->
<?php $this->layout('index') ?>

<?php $this->start('content') ?>
    <h1>CONTENT</h1>
<?php $this->end() ?>

<?php $this->start('subcontent') ?>
    <?php $this->insert('bbb') ?>
<?php $this->end() ?>
<!-- BBB -->
<h2>SUBCONTENT</h2>

@reinink reinink closed this as completed Feb 22, 2014
@reinink
Copy link
Contributor

reinink commented Mar 31, 2014

@mindyk, you may be interested to know that layout stacking (or sub layouts) are now possible in dev-master, coming soon to Plates version 2.0. See issue #10 for more details.

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

No branches or pull requests

2 participants