A
A
Alexander Sharomet2016-02-01 19:27:38
PHP
Alexander Sharomet, 2016-02-01 19:27:38

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

2 answer(s)
D
Dave, 2016-02-01
@sharomet

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.

S
Sergey, 2017-02-15
@sergey444

Look here https://www.youtube.com/user/simpletrainingcom

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question