Просмотр поста #562131: JohnCMS 9.9: Migrating Old Custom Modules Using ?act= to the New Routing System

.
drevils

Hello JohnCMS developers and community members,

First of all, I would like to say that I am very happy with the new JohnCMS version. I really appreciate the hard work and improvements made by the developers. The new architecture, updated features, and improvements make JohnCMS feel more modern and powerful.

Thank you to the development team for continuing to improve this engine and keeping it active.

I would like to ask about migrating and adding custom modules in JohnCMS 9.9.x.

I have an older custom module that uses the ?act= system, for example:

/stats/?act=visitors
/stats/?act=browser
/library/?act=view&id=1

In previous JohnCMS versions, this method was commonly used to handle multiple pages or actions inside one module.

However, in JohnCMS 9.9 I see that the routing system has changed and modules now use:

modules/module_name/config/routes.php

I tried following the new routing documentation:

return static function (RouteCollection $router, User $user): void {
    $router->map(
        ['GET', 'POST'],
        '/stats',
        'modules/stats/index.php'
    );
};

The route file is loaded correctly, but I still need guidance on the correct approach for modules that contain multiple actions.

My questions:

  1. Is the old ?act= style still supported in JohnCMS 9.9?
  2. If it is supported, what is the recommended way to implement multiple actions inside one module?
  3. Should each action now become a separate route, for example:
/stats/visitors
/stats/browser
/stats/keywords

instead of:

/stats/?act=visitors
  1. Is there any example of a simple custom module that handles multiple pages/actions using the new routing system?

I am currently migrating my old custom modules to the new JohnCMS structure and I would like to follow the recommended method from the developers.

Thank you very much for your time and for your great work on JohnCMS.