We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Who can tell me about This INVO {{ content() }} .



16.0k
Accepted
answer
edited Jun '15

Hi,

Phalcon is rendering each part based on rendering levels. So we use {{ content() }} to let the framework know where to render the next level.

Main rendering levels:

  • MainView (is the base theme which includes the layouts). Put here all code that will be common to all your layouts

  • Layouts (make as many as you need. One is enough if the page style doesn't change). Put here all the code that will be common to all views

  • Views (one view per action)

https://docs.phalcon.io/en/latest/reference/views.html#control-rendering-levels

Your diagram is 100% correct



913
edited Jun '15

I can understand those two index.volt , now.

But why rendering the main.volt ? Just by that .

public function initialize() { $this->tag->setTitle('Welcome'); parent::initialize(); It's seems like because this . }

Why not common.volt OR Other it? : )

main.volt is set as default in framework internals, but it can be changed in anything you like with $view->setLayout($layoutNameWithoutExtension)