We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Problems in views


I have a 2 question, when in enter the "/" in my address bar, the Controller Template load successfully but the chiled page not, but when i use view->pick("my_view_name") it,s okay, so what is a problem, when i enter the complete address containing module, controller and actio name, the views work fine ... but when i enter the "/" as address i have to use pick method of view object, here is my routes.

$router->add("/:module/:controller/:action/:params", array( "module" => 1, "controller" => 2, "action" => 3, "params" => 4 ));

$router->add("/", array( "module" => "public_zone", "controller" => "Guests", "action" => "index" ));

My another question is about setTemplateAfter and setTemplateBefore diffrences, what is their diffrences ?

Did you usesetDefaultModule ?

$router = new Phalcon\Mvc\Router();



setTemplateAfter, setTemplateBefore are additional layers you can use for your needs
setTemplateAfter is rendered after Controller View, and setTemplateBefore before Controller View

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