简体   繁体   English

登录后如何重定向到joomla1.5中的当前页面

[英]how to redirect to current page in joomla1.5 after login

I'm working in joomla 1.5 site. 我在joomla 1.5网站上工作。 When sign in, I want to redirect to current page. 登录后,我想重定向到当前页面。 No need to go to index page. 无需进入索引页面。 I'm using redirecttofirstlogin plugin to redirect to desired page. 我正在使用redirecttofirstlogin插件重定向到所需页面。 It works perfectly. 它运作完美。 But i want to pass the current page url to that link. 但我想将当前页面的URL传递给该链接。 How to take even the current url. 如何获取当前网址。

This will return wrong url: JURI::getInstance()->toString() . 这将返回错误的url: JURI::getInstance()->toString()

You can use the following line to get current URL in Joomla 您可以使用以下行获取Joomla中的当前URL

$current_url = JURI::getInstance();

After that you have to pass $current_url variable to desired link as per your functionality. 之后,您必须根据功能将$current_url变量传递给所需的链接。


For Concatenate the URL, you have use this syntax, 对于连接URL,您使用了以下语法,

$base_url = JURI::BASE();

For Concatenate : 对于串联:

$full_url = $base_url."index.php?option=com_properties&view=property&id=19&Itemid=54"; .

Try JURI::current() it will give you the current url. 尝试JURI::current()它将为您提供当前的URL。

Update for joomla 1.5:- joomla 1.5更新:-

$u =& JURI::getInstance( );
echo 'URI is ' . $u->toString();

For more info you can check here- http://docs.joomla.org/JURI 欲了解更多信息,您可以检查这里- http://docs.joomla.org/JURI

If you simply want to redirect to the current page after logging in, then it can be done without any code. 如果您只想在登录后重定向到当前页面,则无需任何代码即可完成。

In the Joomla Backend, go to the Module Manager and open the Login module. 在Joomla后端中,转到“模块管理器”并打开“登录”模块。 There is a parameter called "Login Redirection Page" which all you have to do is set to "Select Item" , so it's basically unselected. 有一个名为“登录重定向页面”的参数,您要做的全部设置为“ Select Item” ,因此基本上未选择它。

I have just tested this myself and it works 我刚刚自己测试了它并且有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM