I'm using 3.1, I should clarify I meant the templating-engine.
I currently have the module working as intended by heeding your advice and sticking to using an outside controller (simple delegate function in Page_Controller for now). Here's how I got it to work so far.
(Slightly different model (pseudo)code, demonstrating what I'm trying to accomplish)
code/Student.php
<?php
class Student extends DataObject
{
/* ... */
public function getInfo()
{
$output = new ArrayList();
$records = $this->get();
foreach($records as $name => $university) {
// modify data here
$output->push(new ArrayData(array('Name' => $modifiedName, 'University' => $modifiedUniversity, 'ExtraData' => $extraData)));
}
return $output;
}
}
templates/includes/IncludedSection.ss
<% if Info %>
<% loop Info %>
$Name ($University)
$ExtraData
<% end_loop %>
<% end_if %>
(This part is where I got lost, I think)
mysite/code/Page.php
class Page_Controller extends ContentController {
/* ... */
function getInfo()
{
$widget = new Student;
return $widget->getInfo();
}
}
I'm pretty familiar with decorators, so I should find some fun with DataExtensions to see if I can refactor a bit and see where that takes me. If it's any help to others starting out, there's a related piece of documentation in member role extension that was also helpful.
Although Page and its Controller aren't core, it seems like the best way to register global methods and configuring data models (not to mention another layer of indirection). I wanted to keep it minimalist.
Thanks for the nudge in the right direction :)