Answer the question
In order to leave comments, you need to log in
Where is it correct to connect smarty in mvc?
Hello.
I have a problem - I can't figure out where it would be more correct to connect the smarty template engine.
If it is like a view representation, then it is logical to connect it and initialize it in the view. But then it is problematic for me to transfer data from the database to it. I connected it directly in the route file which tells which controller to connect. Is it correct? Thanks
Answer the question
In order to leave comments, you need to log in
It does not need to be included in the view, since it is itself a view component. In your case, it should be like this:
1. Model - data / services
2. View - Smarty
3. Controller - receives data from the model and transfers it to smarty
While the router only initializes the controller.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question