Set a URL for browser redirection.

  • string $url - URL to redirect to.
  • string $msg - Message to display on redirect. Optional, defaults to value set internally by controller, if any.
  • string $type - Message type. Optional, defaults to 'message' or the type set by a previous call to setMessage.
  • return \JControllerLegacy - This object to support chaining.
public function setRedirect($url, $msg = null, $type = null)
{
$this->redirect = $url;

if ($msg !== null)
{
// Controller may have set this directly
$this->message = $msg;
}

// Ensure the type is not overwritten by a previous call to setMessage.
if (empty($type))
{
if (empty($this->messageType))
{
$this->messageType = 'message';
}
}
// If the type is explicitly set, set it.
else
{
$this->messageType = $type;
}

return $this;
}
Base Controller
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive