I have a template for a "blog preview" - which is basically just a thumbnail, title, and short excerpt of said blog in a nice concise structure built for repetition in a list.
As hinted above, I intend to pull the top 10 blogs on my site from the DB in my model, transfer them to the controller, which will supply them as for the view. In the view, I will need to loop through the results and populate a new "blog preview" for each blog.
My current solution (which I think may break the rules of MVC) is to do this in the view template:
foreach($this->blogs as $blog) {
$tpl = new Output_Html();
$tpl->title = $blog['title'];
// ...assign other vars
$tpl->render();
}
Somehow this feels like something the view shouldnt be allowed to do? But, how else would I be able to loop through the "preview" templates inside of the main page template?
Help?