I found it!
In BlogHolder_Controller:
function archive() {
if(is_numeric(Director::urlParam('Action'))) {
$year = Director::urlParam('Action');
$month = Director::urlParam('ID');
if($month && is_numeric($month) && $month >= 1 && $month <= 12 && is_numeric($year)) {
$date = new Date('Date');
$date->setValue(array(
'Day' => 1,
'Month' => $month,
'Year' => $year
));
$output =new DataObjectSet();
$output->push(new ArrayData(array(
'Date' => $date
)));
return $output;
} else if(is_numeric($year)) {
$date = new Date('Date');
$date->setValue(array(
'Day' => 1,
'Month' => 1,
'Year' => $year
));
$output =new DataObjectSet();
$output->push(new ArrayData(array(
'Date' => $date->Year()
)));
return $output;
} else {
return array();
}
}
}
Then in BlogHolder.ss:
…
<% if archive %>
<% control Archive %>
<h3 id="ViewingArchived"><% _t('VIEWINGARCHIVED', 'Viewing entries published on') %> <% if Date.Month %>$Date.FormatI18N(%B %Y)<% else %>$Date<% end_if %></h3>
<% end_control %>
<% end_if %>
…
Don't ask me why it is necessary to use a DataObjectSet instead of a simple array: the latter didn't worked. I'm sure there's a lighter and smarter way to do it.
Regards,
Juan