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

Multi-Module Volt Form Action path Issue

Hey everyone,

I'm in the process of building a multi-module CMS using the latest version of Phalcon. I have it set up as a multi-module app ("frontend" for the main site and "backend" for the admin using volt as the templating system. Everything so far has been working fine, but now that I'm putting in the form volt tag, I'm having issues.

{{ form('pages/create', 'method':'post') }}

Since I have my backend module routed to /admin, I would expect the form to have the action set as "/admin/pages/create", but instead it's showing the form action as "/public/pages/create".

Is there some sort of base directory that I need to set somewhere so that /admin is used instead of /public ? This is the only issue I'm seeing so far, so I'm at a bit of a loss.

Heh, I just figured that out a few minutes ago. I registered the url service and set the base path to '/admin/" for the backend module. However, now when I try to use assets in the backend module, it has "/admin/" prepended to the relative path for the file being added via addJS or addCSS. Any way to setup a specific assets directory so it doesn't interfere with the url base path?

Hey men

Try set a service as like this https://github.com/phanbook/phanbook/blob/master/core/modules/backend/Module.php#L38

Just figured out the assets issue as well.

$url->setStaticBaseUri('/');

Change the starting path for static files in the module.php file solves the issue.