How can you structure and route modules in MVC?

I am creating MVC where everything is a module. This will allow me to separate collections of objects, such as a forum and user modules, for further organizing my MVC.

/blog
    /controller
    /model
    /view
/user
    /controller
    /model
    /view
/forum
    /controller
    /model
    /view

I am currently drawing routes for something like forum/edit/34to /forum/controller/edit.php, which contains a class Forum_Controller_Edit. (This is slightly different from the standard approach, when all actions are controller methods Forum_Controller::edit()). This allows me to separate all the individual “actions” of the controller into my own files, so I don’t need to manage large controllers with 10 different actions.

, . , . , , (forum/topic/view/34). "".

/forum
    /controller
    /model
    /view
/topic
    /controller
    /model
    /view

1) URL /topic/view/ forum/topic/view, 2) ( ), 3) "" - , .

, MVC, ( )?

Kohana Framework HMVC . is_file(), , . - , . , , , .

, . , 20 , , . - ?

, ? (/forum), (/forum/view) (/forum/topic/view)? ? , ? ( URI "///34" )

$controller = new \Forum\Controller\Topic\View;
$controller->action('34');

// or
$controller = new \Forum\Controller\Topic;
$controller->view('34');

// or
$controller = new \Forum\Controller;
$controller->topic('view', '34')

2

, , , URL "///34". , URL- , . , , , URL , .

+5
2

,

, -.

20 , , ,

.

. - , URI. URI MVC.

+4

, "" - , .

- , , , . - , -, , , .

, , - , , , , -, .

:

  • , .
  • ( , , ).
0

All Articles