Using $session to pass variable from joomla 3.9 to php file

For Joomla! 3.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Locked
chanteur94
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Sep 10, 2008 10:02 pm

Using $session to pass variable from joomla 3.9 to php file

Post by chanteur94 » Sun Nov 04, 2018 4:37 am

Hi

I have problems to pass variable from Joomla 3.9 to a php file

In joomla, I use
<?php $session = JFactory::getSession(); $session->set('name', "value"); ?>

And in php file
<?php $session = JFactory::getSession(); echo $session->get('name'); ?>

I'm newbee with session. Please be patient :-)

Thank you.
Frank

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17431
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: Using $session to pass variable from joomla 3.9 to php file

Post by toivo » Sun Nov 04, 2018 7:18 am

What is the purpose of your PHP file? Does it bootstrap the Joomla! Framework?
Toivo Talikka, Global Moderator

chanteur94
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Sep 10, 2008 10:02 pm

Re: Using $session to pass variable from joomla 3.9 to php file

Post by chanteur94 » Sun Nov 04, 2018 4:30 pm

My need is a little complex. In fact I'm using Joomla 3.9 and Community Builder 2.2.1

With CB (community builder), there is 2 parts : the user connected (userMe) and the user viewed (userDisplayed). When you clic on a menu (example, contact menu) and you are on a userDisplayed, CB exit from the userDisplayed and turn back to the userMe. (But I want to stay on the userDisplayed (I'm in contact with Joomlapolis and it's not possible to change that).

To get around that, I'm using an external plugin from Tassos (EngageBox) who allows me to open a popup module. So, when I exit from the popup module, I'm always with the userDisplayed.

Now, I have the problem with the popup module who is not 'interactive' and some PHP code didn't work inside. (It is just a form with test on checkbox and radio button). So I create an external file.php to execute some codes.

And now, I need to send some Variables (CB substitutions) from the popup module to this file.php.

That's my problem !!!

smpleader
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 100
Joined: Thu Jun 21, 2012 7:17 am

Re: Using $session to pass variable from joomla 3.9 to php file

Post by smpleader » Tue Dec 04, 2018 4:03 am

Hi Chanteur,
Put some hidden fields in your pop up could make some tricks.
Be care with sensitive information, and it's better to use your own plugin to modify things easier. Many embed cause more complicated to your math.


Locked

Return to “Joomla! 3.x Coding”