I'd like to show my TempPage depending on a StartDate and EndDate.
I manage this with function canView.
"return false" in the last if-Statement gets me to my LoginPage.
Controller::curr()->redirect(Director::baseURL()) results in an endless loop.
Whats the right syntax to redirect to Homepage (home) without ending in a loop?
class TempPage extends Page {
public function canView($Member = null){
$now = date('Y-m-d H:i:s');
if(Permission::checkMember($Member, 'CMS_ACCESS')){
return true;
}elseif($now > $this->StartDate && $now < $this->EndDate){
return true;
}else{
return false;
Controller::curr()->redirect(Director::baseURL());
}
}