Basically i have a couple dates that are changed when the next/prev page button is clicked, but i need to cap it so it can only be clicked +/- 7 Days then the button disappears. here is my controller
$data['date'] = isset($_GET['date']) ? new DateTime($_GET['date']) : new DateTime();
$data['tomorrow'] = new DateTime($data['date']->format('Y-m-d 00:00:00'));
$data['tomorrow']->add(new DateInterval('P1D'));
$data['yesterday'] = new DateTime($data['date']->format('Y-m-d 00:00:00'));
$data['yesterday']->sub(new DateInterval('P1D'));
$data['today'] = date("Y-m-d 00:00:00");
$data['next'] = TRUE;
$data['prev'] = TRUE ;
So if ( date diff of the two dates is more than +/- 7 days ) "die" and buttons dissapear using above variables, we kill page aswell so people cant alter url to access the dates.
If (date diff less than or equal to +/- 6 days) Then show the button
i've tried date_diff but it didnt seem to work , I just need a hand please bare in mind i am an apprentice and have only been using php for 2 months.