如何在Joomla中从一个类变为另一个类?

时间:2014-11-20 12:46:20

标签: php variables joomla

如何将getState变量从一个类变为另一个类?

我需要获得" filter.search"的价值。我怎么能这样做?

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"]);
    }
}

1 个答案:

答案 0 :(得分:0)

您有两个模块可以自动从get / post请求在会话中存储信息,然后将其读回:

JFactory::getApplication()->getUserStateFromRequest($key, $request)

JFactory::getApplication()->setUserState($key, $value);

确保在尝试检索信息之前保存信息!