HMVC and HTML component

I read several articles about HMVC, in PHP and other languages, and in all of them the implementation of this template was that the "Master Controller" requested the Response Body of one or more resources, internal or external, using cURL or Stream Contexts to build Native, either directly through the Response object or through a custom viewer, by assigning template variables with the resulting HTML.

However, all these articles are so strongly attached to the technical concept that in most cases they did not mention all the relevant points. Thus, I came to the conclusion that the main concept of HMVC is, generally speaking, MVC inside MVC, working in both hierarchical and isolated mode, it is always the same.

But how exactly will the HTML compilation of this "Master-Controller" occur, if in order for each subsystem to work the same way in all ways , it will need possible scripts, style sheets, or even additional markup?

The example is easier to understand:

Considering the application developed using Bootstrap 3, consisting of N components, all of them are also developed using the same structure (therefore, they work in isolation exactly the same as in the main application), with HMVC figuratively created with the pseudo-code below:

// Make the Requests

$projects = new Request( 'management/projects', 'GET' );
$clients  = new Request( 'management/clients',  'GET' );

// Creates the Template Variables with Response Bodies HTML

$this -> view -> assign(

    array(

        'projects' => $projects -> send(),
        'clients'  =>  $clients -> send()
    )
);

For clarification purposes, in this snippet, Request :: send () will return HTML

Something similar to:

<html lang="en">

    <head>

    <meta charset="utf-8">

    <link rel="stylesheet"
        href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">

    </head>

    <body>

        <div class="container-fluid">

            <!-- Sidebar -->

            <div class="row">

                <div class="col-sm-3 col-md-2 sidebar" id="sidebar" role="navigation">

                    <ul>
                        <li>Sidebar Item</li>
                        <li>Sidebar Item</li>
                        <li>Sidebar Item</li>
                    </ul>

                </div>

            </div>

            <!-- Main Content -->

            <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">

                <html lang="en">

                    <head>

                        <meta charset="utf-8">

                        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">

                    </head>

                    <body>

                        <div class="container-fluid">Component HTML</div>

                    </body>

                </html>

            </div>

        </div>

    </body>

</html>

"" , , script CSS, HTML, , (, ) ..

, HTML- HMVC?

, , - "-" HTML-, , , , DIV <body></body>.

, .

+4
1

HMVC , MVC JAVA. MVC ( ). , , . , , . : " ?" : " , ", .

HMVC PHP . . , PHP/Web - , Java - .

( MVC 0) - ( MVC 1) - ( MVC N)

, . , , MVC /. CSS/ Script, . , , MVC .

0
source

Source: https://habr.com/ru/post/1569043/


All Articles