Hi Martijn
Thank you so much for your reply! This was really helpful!
I actually managed to get another solution going, where I render the complete list of objects in one control and not the one object at a time. But this is only a matter of having the control-call in the include template or in the actual view.
Solution 1:
public function ControllerGetAll() {
$page = $this->customise(array(
'Pages' => $this->GetAllPages()
));
return $page->renderWith(array("PageList"));
}
PageList.ss
<% control Pages %>
$Title - ({$Link})
<% end_control %>
and used in the view like this:
$ControllerGetAll
But I actually like the other solution better - since its a bit cleaner.
Solution 2
Model describes a rendering for one object:
public function MyView(){
return $this->renderWith(array('PageRendering'));
}
in view:
<% control GetAllPages %>
$MyView
<% end_control %>
PageRendering.ss
$Title - ({$Link})
//the control-blocks are moved to the "main-view" instead of inside the included rendering
The cool thing about solution 1 is that it can be used as a REST-ful ajax-call-include since it will give you the complete list rendering on www.yourdom.com/controller/ControllerGetAll !!