Reputation: 177
I have a problem, I hope that you can help me: I programing a litle component and module in Joomla.
This component and module read a variable of php session (this variable is set before for external php script).
External php script:
define( '_JEXEC', 1 );
define( 'JPATH_BASE', realpath(dirname(__FILE__).'/..' ));
require_once ( JPATH_BASE. '/includes/defines.php' );
require_once ( JPATH_BASE. '/includes/framework.php' );
$mainframe = JFactory::getApplication('site');
$mainframe->initialise();
//session_start();
$session = JFactory::getSession();
$session->set('namevar', base64_encode('message'));
Joomla's module and component (have the same code):
$session = JFactory::getSession();
$mymessage = $session->get("namevar");
echo $mymessage ;
The curious thing is that:
-The module works fine.
-The component not works (and if I do a var_dump($mymessage) it shows NULL).
Moreover, this code works time after :S
Any idea? A lot of thanks!
Upvotes: 0
Views: 197