Rendering multiple views within widget

Hi,

I have a widget where I want to loop through an array and display multiple views something like





foreach ($this->types as $k => $v) {

   return $this->render($k.'DisplayCreate'); 	 

}




where $this->types looks like




Array (

   [singleImage] => Array( .....)

   [multipleImage] => Array(.....)

)



Clearly only the first call to the view template (eg singleImageDisplayCreate) gets called from the widget. Is there any way I can render both templates using render() rather than putting my code inline with the widget itself?

This is normal because you use "return". So it shows only the first.




$html = '';

foreach ($this->types as $k => $v) {

   $html .= $this->render($k.'DisplayCreate');     

}

return $html;



Hi Timmy, many thanks - didnt think to build a string! many thanks