I have page which lists a series of publications...some of the publications link to a PDF file while others link to another HTML page (for example, if the publication has a series of volumes).
In my controller I have the following function to grab the list of publications:
function Publications() {
$publications = new DataObjectSet();
$results = DB::query("SELECT publication.*, file.Filename
FROM publication_practice LEFT OUTER JOIN publication ON publication_practice.PublicationID = publication.ID
LEFT OUTER JOIN file ON publication.PDFLinkID = file.ID
WHERE publication_practice.PracticePageID = '{$this->ParentID}'
ORDER BY Date DESC, Title ASC");
if ($results) {
foreach($results as $result) {
$htmllinkID = $result['HTMLLinkID'];
$publications -> push (new ArrayData (array (
'Title' => $result['Title'],
'Date' => $result['Date'],
'Filename' => $result['Filename'],
'Abstract' => $result['Abstract'],
'HTMLLink' => DataObject::get('PublicationPage', "sitetree_live.ID = '$htmllinkID'")
)));
}
return $publications;
}
return false;
}
In my template, ($Date) will output (2010-02-01) however, ($Date.Format(F Y)) outputs just () rather then (February 2010). My sense is that the date is being converted to a string when it is pushed to the array. So...is there a way to (1) push it to the array as a date, (2) format it as I'm pushing it into the array (the several things I've tried haven't worked), or (3) another way to get it formatted in the template? Thanks.
Cheers,
Laurie