S
S
Snewer2016-11-14 13:03:53
Yii
Snewer, 2016-11-14 13:03:53

How to organize the output of categories within MVC?

Hello!
The database has a table for categories. Categories have a tree structure. What is the best way to organize the output of category selection to the end user? Write a model method that collects a "tree" (array), and then parse this tree back in the view and display the data? What is the best way to do it?
Also, this logic needs to be used in different places, that is, most likely this logic needs to be moved to the widget. Here are the same questions, how to competently implement the transfer of data from the database (model) to the view.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2016-11-14
@webinar

Widget - receives data builds an html tree from the data
Model - receives data from the database
Controller - passes the model to the view

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question