M
M
Maxim2014-03-18 23:19:37
Yii
Maxim, 2014-03-18 23:19:37

Where is the best place to generate content?

I wrote a code that collects the html code of the menu from an array with parameters. The question is that I don’t know where such code should be placed, in the controller to collect everything in $content and give it to the show, or should the view be involved in such matters?
bT9d8vQ.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Y
Yuri Morozov, 2014-03-18
@Frapsy

How about a widget (including the standard CMenu)?

K
Konstantin Velichko, 2014-03-19
@Zoxon

In the helper
And it would be better to collect into some variable, and not immediately echo out
Or make a separate view and method

D
Dialog, 2014-03-19
@Dialog

Create your own widget (the class is inherited from CWidget), it has a run() method, in which you can start rendering the widget's view. I would not recommend the helper option because of the broken windows theory.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question