Support Joomla!

references:joomla.framework:application:jcontroller-redirect

Table of Contents

redirect

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage Application Class JController Method redirect Reference 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.

Syntax

boolean redirect ()

Examples

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).


 
references/joomla.framework/application/jcontroller-redirect.txt (746 views) · Last modified: 2007/08/15 14:48