I am new to OOP frameworks in general and Silverstripe in particular. I'm sure I'm missing something vital!
I am currently trying to create a twitter feed for my main page. In my Page_controller I have:
public function getTwitterFeed() { ... }
...which gets a set of tweets. I can format this data any way I like so the structure of the data and the function should be irrelevant.
In the Silverstripe tutorials they give the following example:
public function LatestNews($num=5) {
$holder = NewsHolder::get()->First();
return ($holder) ? News::get()->filter('ParentID', $holder->ID)->sort('Created', 'DESC')->limit($num) : false;
}
This is then called in the template as follows:
<% loop LatestNews %>
<% include NewsTeaser %>
<% end_loop %>
However this function is based on a DataModel object (NewsHolder) and is getting data out of the database (which my twitter function is not).
So what type of variable should this function return? An array? An object?