Rosi Evangelin
Rosi Evangelin

Reputation: 55

Redirection from component to view in joomla 2.5.8

I am new to joomla. am using joomla 2.5.8 version. i have created one component. i can post form data from view to task in component. but i couldn't redirect from task to view. this is my simple function in controller. This URL is saved in Redirect manager.

  function sample(){

        $mainframes = JFactory::getApplication();
        $link=  JRoute::_('index.php?option=com_new',FALSE);
        $msg = JText::_('welcome');

        $mainframes->redirect($link,$msg);
    }

Upvotes: 3

Views: 15027

Answers (2)

Ahmad
Ahmad

Reputation: 57

$id = JRequest::getVar('id');
$app = JFactory::getApplication();

$url = JRoute::_('index.php?option=com_iop&task=plan.edit&id=' . (int)$id);
$app->redirect($url);

Upvotes: 4

Anriëtte Myburgh
Anriëtte Myburgh

Reputation: 13517

This works for me in my component's custom task, release():

# Get iop_id from query string
$app = JFactory::getApplication();
$iop_id = $app->input->get('id');

$url = JRoute::_('index.php?option=com_iop&task=plan.edit&id=' . (int)$iop_id, false);
$app->redirect($url);

Upvotes: 8

Related Questions