I decided to use the HMVC opportunity to more clearly divide the site into blocks. I thought about this structure. In the files of the form where necessary, I display the menu.
echo Request::factory('/blocks/menu/topmenu')->execute();
Where do you need a sidebar.
echo Request::factory('/blocks/sidebar/rightsidebar')->execute();
To display other information such as a news list is the same.
echo Request::factory('/blocks/widget/news')->execute();
The controllers are located in Controller/Blocks/<ΡΠΈΠΏ_Π±Π»ΠΎΠΊΠ°>/<ΠΈΠΌΡ_ΠΊΠΎΠ½ΡΡΠΎΠ»Π»Π΅ΡΠ°>
. The route has the corresponding Blocks/<ΡΠΈΠΏ_Π±Π»ΠΎΠΊΠ°>/<ΠΈΠΌΡ_ΠΊΠΎΠ½ΡΡΠΎΠ»Π»Π΅ΡΠ°>
view Blocks/<ΡΠΈΠΏ_Π±Π»ΠΎΠΊΠ°>/<ΠΈΠΌΡ_ΠΊΠΎΠ½ΡΡΠΎΠ»Π»Π΅ΡΠ°>
Controller example
<?php defined('SYSPATH') or die('No direct script access.'); class Controller_Blocks_Menu_Topmenu extends Controller { public function action_index() { $content=View::factory('/blocks/menu/topmenu'); $this->response->body($content); } } // End Menu (HMVC)
How to create a universal route for all of them, and so that there is a check that the request was executed only internal, that is, the user cannot directly enter the data of the route into the address?
Tried it turned out cumbersome and did not work, and it seems tugovato, for a long time with the framework did not really work.