简体   繁体   English

如何在joomla组件之间进行通信?

[英]How to communicate between joomla components?

In my website a registered user navigates through various components, I am thinking of using session variable for all communications between components instead of a POST /GET. 在我的网站中,一个注册用户浏览了各个组件,我正在考虑将会话变量用于组件之间的所有通信,而不是POST / GET。 Is this a right thing to do? 这是对的事吗?

I have several custom joomla 2.5 components written by me. 我有几个我编写的自定义joomla 2.5组件。 Things like login welcome page, application1 and so on. 诸如登录欢迎页面,application1之类的东西。 Now the welcome page has buttons to these applications and instead of using a post/get I am thinking of using session variables. 现在,欢迎页面上有这些应用程序的按钮,而我正在考虑使用会话变量,而不是使用发布/获取。 I am new to web technologies and I want to know pros and cons of this approach. 我是Web技术的新手,我想知道这种方法的优缺点。

There's no need to use superglobals like $_SESSION when you're using a CMS like Joomla. 当您使用像Joomla这样的CMS时,不需要使用$_SESSION这样的超全局变量。 Instead, use: 而是使用:

JRequest::setVar("varName");

and

JRequest::getVar("varName");

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

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