In terms of filtering by month, I myself haven't attempted to create such a function. But you could attempt making a function like this, which would come out something like this http://www.mycoolsite.com/news/april (calling the method)... using urlParams like so:
function showarchive() {
$month = addslashes($this->urlParams['ID']);
return array(
'Children' => DataObject::get('NewsArticle', 'ParentID = $this->ID AND DATE_FORMAT(`NewsArticle_Live`.`Date`, "%Y-%M") = "$month"'),
);
}
Note: I have no idea if this actually works, it's just an idea I've been toying with. I do believe a news module would be nice, though, with all these helper functions already there to use.
In terms of searchable news content - this works out of the box if you implement the search tutorial found here: http://doc.silverstripe.com/doku.php?id=tutorial:4-site-search
Having the last 10 articles you can filter by the Date defined on the NewsArticle page's Date field. eg. a function on the NewsHolder class:
function Articles($pageLimit = 10) {
// checks to ensure limit is correctly set
if(!is_numeric($pageLimit)) $pageLimit = 0;
if($pageLimit == null) $pageLimit = 0;
// checks to ensure start variable is correctly set
if(!is_numeric($_REQUEST['start'])) $_REQUEST['start'] = 0;
$limit = $_REQUEST['start'] . ',' . $pageLimit;
$callerClass = 'NewsArticle';
$filter = '`ShowInMenus` = "1" AND `ParentID` = "{$this->ID}"';
$sort = '`NewsArticle_Live` . `Date` DESC';
$entries = DataObject::get($callerClass,$filter,$sort,'',$limit);
return $entries;
}
In your template you would call like this, note the parameter for the control, which you can change in the template itself, overriding the default of 10 we defined above. Good for separation of code from template.
<% if Articles %>
<ul class="articleList">
<% control Articles(15) %>
<li>
<h3>$Title</h3>
<p>$Content.FirstParagraph(html)</p>
</li>
<% end_control %>
</ul>
<% end_if %>
<% if Articles.MoreThanOnePage %>
<div id="PageNumbers">
<% if Articles.NotLastPage %>
<a class="next" href="$Articles.NextLink" title="View the next page">Next</a><% end_if %><% if Articles.NotFirstPage %><a class="prev" href="$Articles.PrevLink" title="View the previous page">Prev</a><% end_if %>
<span>
<% control Articles.Pages %>
<% if CurrentBool %>$PageNum<% else %><a href="$Link" title="View page number $PageNum">$PageNum</a><% end_if %>
<% end_control %>
</span>
<p>Page $Articles.CurrentPage of $Articles.TotalPages</p>
</div>
<% end_if %>
Note the extra MoreThanOnePage controls here. These are available if you've got more than 15 articles, so it allows for pagination. To get this out of the box, you need to make sure you've set the limit in your DataObject::get as a limit starting at record. eg 1,5... which gets 5 records from the database starting at record 1.
Hope this helps,
Cheers,
Sean