How to request configurations from a database in user MVC?

I work on a multilingual website that its owner requires most configurations / parameters - which must be set first - for storage in a database, for example:

  • default language
  • default action
  • default theme
  • etc...

I am confused where to request this config (since I'm still in the logic of the MVC approach).

  • Request configuration directly from the configuration file? (Is it possible to query a database from a non-model file / class?)
  • Create a class file that applies to all configuration sets in the / core directory, for example: language.php, theme.php and the query database in these files?
  • Use models only to request these configurations?
  • If you are using models, should I access them directly from the configuration file or use the controller to access them? (If I understand correctly, the controller is just the environment between views and models?).
  • Other offers...?

The root of the application contains the following:

  • backend
    • core
    • Lib
    • Models
    • configuration
    • view
    • Controllers
    • Assistants
    • Handlers
  • front end
    • IMG
    • CSS
    • Js
+5
source share
1 answer

I ended up using the model and controller, but a bit more complicated. But as soon as this was done, the owner was pleased, since it was more convenient for him to switch the default admincp by default without editing the files for this.

0
source

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


All Articles