Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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.


1.7k
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


48.3k

Use forward to continue flowing through the dispatch cycle (with ACL security checks) and use redirect to start over and have the browser access another location. Unless you do lots of custom work that can have downsides then it is necessary to redirect if you want to access a different module. So figure that on execution only a single module comes into play and that allows you to compartmentalize well.