Sorry still learning Yii so newbie question.
I have a site im converting over to Yii from a system i wrote. The question i have is should the control generate HTML and pass it onto the View, or should i write a widget to do the html generation and the control just format the data?
The code im talking about generates sub-pages on the main site like the Quick Dial plugin in firefox. I know that the querying of the DB should be done in the control but from there im not sure about the split.
My inclination is to create an object, in the controller, that has the data to create the pages like: (not the actual data just a visual representation)
$tabs->pageID ->array( pageTile -> 'test title'
PageNumber -> '1'
pageItems -> array( row1 -> array(
->item[1] -> array( linkTitle -> 'link Title'
link_Image -> 'image1.jpg'
linkUrl -> 'http://mylinkurl.com'
)
)
)
Then create a widget that consumes this data block and formats it for display.
Is this the correct way of doing things in the Yii frame work? I the reason why i ask is that it looks like a lot additional code that was done more simply in my old app. I can see that doing it this way would make the data more portable as it could be consumed by different widgets.
Your proposed solution is IMHO the correct way.