He wrote:
return DataObject::get("ArticlePage", "ParentID = {$this->ID}", "Created DESC", "", $limit);
Where $this->ID is the ID field of the current row in the database, so you can access fields using $this->[your_fieldname_here] syntax.
For example, this is how my current LatestNews looks like:
function LatestNews($limit = null) {
if (null == $limit)
$limit = $this->Limit;
return DataObject::get("ArticlePage", "ParentID = {$this->ID}", "Created DESC", "", $limit);
}
I have created an additional field named 'Limit' in the db to make the number of displayed ArticlePages configureable from the CMS, but still overrideable from the templates.