How can set global variables? - Joomla! Forum - community, help and support
hello,
i'm trying write own joomla 2.5 component , modul. now, need set session-like global variables, can use in components, plugins , modules same way.
i've tryed write little 'system plugin', writes needed variables jsession via 'set' funktion. don#t seems work, because didn't results using print-r or echo inner plugin or other plugin/component/module.
where have set session variables correctly?
i'm trying write own joomla 2.5 component , modul. now, need set session-like global variables, can use in components, plugins , modules same way.
i've tryed write little 'system plugin', writes needed variables jsession via 'set' funktion. don#t seems work, because didn't results using print-r or echo inner plugin or other plugin/component/module.
where have set session variables correctly?
this works in joomla platform 12.3:
code: select all
// write log text file
$logcat = basename(__file__);
$log_options = array(
'text_file' => 'mylog.log',
'text_file_path' => jpath_base,
);
jlog::addlogger($log_options);
$input = new jinput;
$session = jfactory::getsession();
// session start requires $input
$session->initialise($input);
// set session state active
$session->start();
$session->set('expire', '20');
$msg = '$_session = ' . print_r($_session, true);
jlog::add($msg, jlog::info, $logcat);
Comments
Post a Comment