Answer the question
In order to leave comments, you need to log in
A couple of questions about MVC. Can you help?
Hello!
Wrote my mini-framework. So. The site has a choice of currency, there will be 2 variables with types (wmr, wmz, wme) and names (rubles, dollars, euros) where the types are used in the model, and the name in the visualization. How to store them correctly and where?
One more question. There are some parts of the site that are repeated on many pages of the site, and their content is taken from the database. To request them every time in the controller? those. duplicate code in model and controller? what do you advise?
Answer the question
In order to leave comments, you need to log in
what do you advise?
in the model you implement the selection, in the controller you call the model and pass it to the template. In the template, display data through a loop.
The main page controller (for example) receives a request, and pulls the widget. The widget pulls the database, which returns an array to it from mysql. This array is passed from the model to the widget template. Next, the widget returns an already generated view to the main page controller, which the main page controller passes to the template.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question