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

Dynamic controller path

Hello,

I would like to be able to call multiple sub-directory controller.

Under a plugin path, I have a list of directory witch include controller sub directory. And I'll like to be able to register a new routes and specially a new path, on plugin load.

I've seen how to register a new routes, but I'm not figuring out how to use it to indicate a sub-directory.

My aim, is to be able to call /plugin/toto/drawme/200/400

And that would call and run the controller toto, and the action drawme. Which is store in /app/plugin/draw/toto/controller/indexController.php, and this will load also : /app/plugin/draw/toto/views/index/inde.volt

Any help, is welcome. PLeeeeeease Heeeeeeeeeeelp

Regards

And what exactly is a problem? Controllers can be in whatever path you want.

Dear Wojciech,

Thanks for your reply.

This is surely obvious to you, but really not yet clear for me. It seems I found a way by indicating the full path

\Plugins\Draw\Toto\Controller\ and calling the url as https://dom.main/plugins/draw/toto/controller/<controllernamer>/<actionname>/<params>

But I wanted to be able to just call the namespace \Plugins\Toto\<controllernamer>\<actionname>

And being finally able to call : https://dom.main/toto/<controllernamer>/<actionname>/<params>

And of course, that all plugins may load dynamically, just by adding one it should be accessible.

But I did not find the way, I beleive it is possible, but not understanding how.

Regards