21309 Posts in 5738 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1289 Views |
-
Adding a value to DataObject Set

31 May 2010 at 10:06pm
Hi all
I've been wracking my brain over something I'm sure is very simple, but it's driving me mad! I need to iterate through a DataObjectSet to find any results that fall within a specific date range so that I can highlight a current event. I think I'm close to the result, but I just can't figure out how to add a value to my DataObjectSet to flag this result in my template.
Here's my code - any advice most welcome!
function ExhibitionSydney() {
$now = date("Y-m-d",time());// Retrieve all Exhibitions
$exhibitions = DataObject::get('Exhibition', '','DateFrom DESC');// Iterate through Exhibitions to find any that fall on the current date
foreach($exhibitions as $exhibition){
if ( $now >= $exhibition->DateFrom && $now <= $exhibition->DateTo ) {
// if the result falls within the current date, add Current=>true to the dataobjectset
???????
}
}
return $exhibitions;
}I'm running SS 2.3.7
Thanks for any assistance in advance,
Y
-
Re: Adding a value to DataObject Set

31 May 2010 at 10:30pm
Oh man was I overthinking that one. Thanks heaps it's done the trick.
Cheers, Y
| 1289 Views | ||
|
Page:
1
|
Go to Top |

