How To Add A Redirect In Joomla 1.5 MVC Component

Posted: December 19, 2012 in Uncategorized
Tags:

Today I want to show you how easy it is to set a redirect in your Joomla Component. Below is the easiest way to go about this.

$app = JFactory::getApplication();
$app->redirect($link, $msg);

You will want to make sure that there are variables set for $link and $msg. Also this is best used with an IF statement. Here is a full example on how to use the redirect.

if($user->guest):
   $link  = 'index.php';
   $msg   = 'You are not logged in.';  

   $app = JFactory::getApplication();
   $app->redirect($link, $msg);
endif;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s