Hi,
I have this function which works on the productpagina page itself, but not on other pages. Basicly what it does and needs to do on other pages is to display a product when it is between 2 dates that are filled in. Im not much a php expert, so i was hoping someone here might be able to help me with this.
The thing i dont get working on the other pages is the start and end date.. im not sure how to define them in the page.php.. since $this-Begin,time() doesnt work. I've tried a couple of things, but they dont seem to work.
function BetweenDates() {
$begin = date($this->Begin,time()); //Begin date
$einde = date($this->Einde,time()); // End Date
$today = date('Y-m-d', time());
$Productpaginas = DataObject::get('Productpagina', '','','',null); //Get the class
foreach($Productpaginas as $Productpagina){
if ($begin <= $today && $einde >= $today ){
return $Productpagina;
} else{
return false;
}
}
return $Productpaginas;
}
Kind Regards, Jan