D
D
Denis Oleshkevich2012-01-29 10:05:25
Web development
Denis Oleshkevich, 2012-01-29 10:05:25

Persistent content in MVC web frameworks?

Suppose we have a website running on one of the MVC frameworks. There are a lot of entities and pages on the site. But the pages always show a side column with a block displaying random images from the site.
The question is, according to the MVC paradigm, data should be pulled from the model in the controller and passed to the view, should it be the same in this case?
Or is it worth getting the data exactly where they are used, bypassing the controller?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
N
notRly, 2012-01-29
@notRly

One implementation option is to use widget logic. Those. have a plug-in library that implements MVC already in itself.
The second option is to use a more complex renderer than the framework offers. In the renderer, describe the logic for displaying sidebars and generally assemble the page template from separate parts.

V
Vladimir Chernyshev, 2012-01-29
@VolCh

If you want to keep architectural purity, then you should probably take a closer look at PAC / HMVC

A
Anatoly, 2012-01-29
@taliban

Who told you such nonsense that models should give data _only_ through the controller? In Zend, for example, there are models that work bypassing the controller, and they are called view helpers. The same above plugins are also essentially models.

M
mayorovp, 2012-01-29
@mayorovp

The controller is not a postman that passes data from the model to the view, but an independent component that implements business processes.
If no business process is associated with the display of a certain block, then it does not need a controller at all.

Y
Yuri Morozov, 2012-01-29
@metamorph

If the sidebar is shown everywhere, you can stick your base controller between the base controller of the framework and the working controller.
And there already to extract the contents of the sidebar.
Well, if the framework allows this, of course.

S
Stdit, 2012-01-29
@Stdit

If these are really random pictures, you can, for example, include them via SSI on the web server side.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question