Larry Vollmer
asked on
PHP question
I have a very basic question - just started using cakephp and i am having trouble getting my index page to render.
I have two pages: 1 is the index page and one is the expiration page. I have a date set, and if the current date does not exceed the $expiration_date, the index page is supposed to render. I keep getting a 404 error - am I doing anything obviously wrong?
I have two pages: 1 is the index page and one is the expiration page. I have a date set, and if the current date does not exceed the $expiration_date, the index page is supposed to render. I keep getting a 404 error - am I doing anything obviously wrong?
<?php
class ftaf2Controller extends AppController {
/**
* @access public
* @var string
*/
public $name = 'ftaf2';
/**
* @access public
* @var array
*/
public $uses = array(
'Coupon'
);
/**
* @access public
* @var array
*/
public $components = array(
'Session',
'EmailDeployment'
);
/**
* beforeFilter callback
*
* @since 0.3
* @access public
* @return void
*/
public function beforeFilter() {
$expiration_date = '2011-12-06 00:00:00';
if (date('Y-m-d H:i:s') > $expiration_date) {
$this->render('expired');
exit;
}
public function index() {
}
}
?>
First you are not comparing dates correctly, use the strtotime function to compare dates.
ASKER
can you show me an example of what should be done?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Oh, remove the printf statements after you understand what is happening.
ASKER
thanks