According to the Hierarchical Rendering here, content of app/views/layouts/posts.phtml should appear when loading /posts URI (http://localhost/myapp/posts*). So I tested the example given in the documentation:
<!-- app/views/layouts/posts.phtml --> <h2>This is the "posts" controller layout!</h2> <?php echo $this->getContent(); ?>
<!-- app/views/index.phtml --> <html> <head> <title>Example</title> </head> <body> <h1>This is main layout!</h1> <?php echo $this->getContent(); ?> </body> </html>
and it works, so great.
But I am wondering why do we have to use <?php echo $this->getContent(); ?> to make the "hierarchy system" actually work (if one remove it, it does not work anymore), what the point of having an "hardcoded" system if one have to add this code ?