| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
Application |
JController |
redirect |
redirect() |
Never | Work in Progress |
Redirects the browser or returns false if no redirect is set.
The redirect is set using the JController->setRedirect() method. It will invoke the JApplication->redirect() method.
This will end execution unless redirect is not set, in which case the method returns false.
boolean redirect ()
The code that instantiates the controller, executes the task and redirects might look like:
Example
$classname = 'WeblinksController'.$controller; $controller = new $classname( ); // Perform the Request task $controller->execute( JRequest::getVar('task')); $controller->redirect();
with the code in the task handling method being:
$link = 'index.php?option=com_weblinks'; $this->setRedirect($link, $msg);
which would cause the browser to be redirected to the specified address. The message specified by $msg will be displayed on the target page (this is passed using the session).