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

Multiple MVC module

I am using multiple mvc (https://github.com/phalcon/mvc/tree/master/multiple) and I need load view of the frontend in the backend.

Is there a way to call the controller of a module in another?

Example:


    <?php

    namespace Multiple\Backend\Controllers;

    class index(){

    public function indexAction(){
        $this->seVars(array('editor' => true));
        $this->view->render('frontendController/frontendAction');
    }


339
Accepted
answer

This will not work, when you register the view component is necessary set the views directory (see in multiple mvc this files: apps/backend/Module.php:42 and apps/frontend/Module.php:45).

If you need to use shared views the best solution is use multiple shared views structure (https://github.com/phalcon/mvc/tree/master/multiple-shared-views).

Thanks, I need load only one view and I did not want to use shared views just for that. But if it is the only way..

I found a solution today, you can replace the view in Application see in this gist: https://gist.github.com/ferfabricio/fada1acca77282aa4c58