[英]How to get variable from one class to another in Joomla?
How do I get the getState
variable from one class to another? 如何将
getState
变量从一个类转换为另一个类?
Exactly I need to get value of "filter.search". 确实我需要获取“ filter.search”的值。 How can I do that?
我怎样才能做到这一点?
jimport('joomla.filesystem.folder');
abstract class SroHelper
{
public static function checkIP()
{
SroModelItems::getState(filter.search); ---- ??
}
}
jimport('joomla.application.component.model');
class SroModelItems extends JModel
{
protected function populateState($ordering = null, $direction = null)
{
$this->setState("filter.search", $jform["search$dbextra"]);
}
}
You have two modules to store information in the session automatically from a get / post request and then to read it back: 您有两个模块,用于根据get / post请求自动将信息存储在会话中,然后将其读回:
JFactory::getApplication()->getUserStateFromRequest($key, $request)
JFactory::getApplication()->setUserState($key, $value);
Just ensure you are saving the information before you try to retrieve it! 只需确保保存信息,然后再尝试检索它!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.