I've got a page right now that's built using a class. It's a pretty complicated class and has about 6 main sections, some of which loop. I'm thinking it would make more sense to do some of the looping sections as classes themselves. So essentially I'll be creating new class instances within the class.
For example, I'd have a class called "Page", with methods for the header, formatting of the overall page, main content and footer. Within the class are a couple of lists that generate a number of list items, each with a fair bit of formatting.
Are there any problems (in a general way) doing things this way?
Can I return values from a class the same way I do from a function? I can't return them to a class variable (like $this->variable) because the variable would stay within the class. I basically need to "kick" the returned value out one level so I can use it in the outer, containing "Page" class. The other option is to just echo them, but that doesn't work too well for my situation.
Any advice?