× Please submit new Bug Reports on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues

Redirect to home after saving

8 年 9 个月 前 #1213 Marcos
Redirect to home after saving was created by Marcos
Hi, could someone help me redirect to the main page after you saved the item on the front end?

At controllers.php I found this line:

// Redirect to the list screen.
$this->setMessage(JText::_('COM_PEDIDODEMUSICA_ITEM_SAVED_SUCCESSFULLY'));
$menu = JFactory::getApplication()->getMenu();
$item = $menu->getActive();
$url = (empty($item->link) ? 'index.php?option=com_pedidodemusica&view=pedidos' : $item->link);
$this->setRedirect(JRoute::_($url, false));

I need change to redirect to home. Thank You
附件:

Please 登录注册一个帐号 to join the conversation.

8 年 9 个月 前 #1214 Francesco Reitano
Replied by Francesco Reitano on topic Redirect to home after saving
it's easy, change $url:
$url="index.php";
The following user(s) said Thank You: Andres Maeso

Please 登录注册一个帐号 to join the conversation.

8 年 9 个月 前 #1220 Marcos
Replied by Marcos on topic Redirect to home after saving
Works man.. thankyou! But at the last line i need change to:

$this->setRedirect($url);

:)

Please 登录注册一个帐号 to join the conversation.

8 年 5 个月 前 - 8 年 5 个月 前 #1351 Dariusz
Replied by Dariusz on topic Redirect to home after saving
I have the same question but concerning backend. Can anybody help me please? (concern task save)

EDIT
SOLVED:

overwrite controller:

public function save($key = null, $urlVar = null)
{
$return = parent::save($key, $urlVar);
$this->setRedirect( JRoute::_( 'index.php' ));
return $return;
}
Last edit: 8 年 5 个月 前 by Dariusz. 理由: ADD SOLVED

Please 登录注册一个帐号 to join the conversation.

创建页面时间:0.094秒
核心: Kunena 论坛

We use cookies so that you can place orders and we can provide a better service. You can control the use of cookies at the individual browser level. If you reject cookies, you may still use our website, but your ability to use some features or areas of our website may be limited.