I’m an MVC newbie but I have a fair bit of experience as a programmer. I would like to hear your opinion on an MVC issue.
Thing is, I have some nested data in my model. I cannot reliably make assumptions about the structure of the data in terms number of levels etc., because that structure is implicit in a database table (row elements that have pointers to parents). Which means I cannot hardcode the structure as ie. foreach(foreach)-loops in a view.
So where do I put the code to present it? I’m reluctant to add HTML-producing code in my model but I also don’t want to add a lot of complex, possibly recursive code to the view or controller.
Another thought is that I send HTML-snippets from the controller to some sort of decoration method in the model. But that means I get some HTML in the controller…
What do you think?