How to redirect using the Joomla! 1.5 and 2.5 API

When developing a Joomla! Component or Module you can use the Joomla! API to redirect the user from one page to another

Joomla! 1.5 Example

global $mainframe;
$link = 'http://yourlink';
$msg = 'message'
$mainframe->redirect($link, $msg, $msgType='message');

Joomla! 2.5 Example

$app = JFactory::getApplication();
$link = 'http://yourlink';
$msg = 'message'
$app->redirect($link, $msg, $msgType='message',$moved=false);

Take note that $msgType can be either messagenotice or error

The API page can be accessed here for Joomla! 1.5 and here for Joomla! 2.5

Image Credits: Photo by Isis França on Unsplash.

More Similar Posts

No results found.