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

how do you render 2nd level views i.e. signup/elephants, signup/lions

SignupController and a signup folder with an index.volt is no problem

  • How do you render signup/elephants --> indev.volt
  • How do you name the controller for signup/elephants - ElephantsController? and where should it reside in controllers folders.


3.6k
Accepted
answer

Here 's how i solved this,

  • in ControllerBase added a new method that uses dispatcher and does a $this->dispatcher->forward

protected function forward($uri) { $uriParts = explode('/', $uri); $params = array_slice($uriParts, 2); return $this->dispatcher->forward( array( 'controller' => $uriParts[0], 'action' => $uriParts[1], 'params' => $params ) ); }

  • In signup controller -> added a elephantsAction

public function elephantsAction() { $this->forward("elephants/index"); }

  • in view folder created a new folder "elephants" with index.volt