Hi all,
I implemented a tiny code on the default.php page of my category so I can have a breadcrumb. Everything's ok but I need to pass on a session variable form my index page (joomla 2.5) to the default page (Virtuemart 2).
I've been using a simple $_SESSION in between the two of them but they don't seem to connect. so my variable from joomla stays blank on the default.php page. I know the problem has been addressed before and quite a long time ago (found a 2007 subject). Is there any way to pass on the variables? Should I use a $_GLOBAL?
Thanks in advance.
does this not work?
$session = JFactory::getSession();
$myvar = $session->get('myvar');
Quote from: fabvincent on December 09, 2013, 10:59:10 AM
Hi all,
I implemented a tiny code on the default.php page of my category so I can have a breadcrumb.
Ehrm strange, breadcrumbs are native there.
Quote from: fabvincent on December 09, 2013, 10:59:10 AM
Everything's ok but I need to pass on a session variable form my index page (joomla 2.5) to the default page (Virtuemart 2).
What? You cannot pass a session variable between two pages on the same server. they HAVE THE SAME SESSION!
Quote from: fabvincent on December 09, 2013, 10:59:10 AM
I've been using a simple $_SESSION
If you are in joomla, you maybe should use the stuff which joomla gives you. Else you can destroy your session, which makes your joomla installation unusable.
Quote from: fabvincent on December 09, 2013, 10:59:10 AM
in between the two of them but they don't seem to connect.
Please learn first the basics about what the session is. http://php.net/manual/en/intro.session.php
Quote from: fabvincent on December 09, 2013, 10:59:10 AM
Should I use a $_GLOBAL?
Thanks in advance.
Session IS within the $_GLOBAL
and this is the way todo it (regardless in which component of joomla)
$session = JFactory::getSession();
$previousValue = $session->set('myValue', $value,'myNameSpace');
and you get it like this
$session = JFactory::getSession();
$value = $session->get('myValue', myDefault,'myNameSpace');