header(\"refresh:5; url=\'pagetoredirect.php\'\");
we can use this if we want to redirect our page in 5 second ,
is there any way to redirect page in 5 second in
/cake/libs/controller/controller.php
/**
* Convenience and object wrapper method for header(). Useful when doing tests and
* asserting that particular headers have been set.
*
* @param string $status The header message that is being set.
* @return void
* @access public
*/
function header($status) {
header($status);
}
...
Which shows that the Controller::header( ) function is a simple wrapper for direct calls to the php function header( ).
http://api.cakephp.org/class/app-controller#method-AppControllerheader
So - to accomplish what you want to do:
/app/controllers/examples_controller.php
'examples', 'action' => 'someOtherAction' );
$this->set( 'url', $url );
$this->header( "refresh:5; url='".Router::url( $url )."'" );
}
...
}
?>
I pass the url to the view and don't die( ) or exit( ) in case you actually wish to render a view. An example:
/app/views/examples/some_action.ctp
Html->link( "You are being redirected to ".Router::url( $url )." in 5 seconds. If you do not wish to wait click here.", $url ); ?>