EllisLab text mark
Advanced Search
     
Storing session variables with PHP’s native sessions
Posted: 07 April 2008 04:32 PM   [ Ignore ]
Avatar
Joined: 2007-09-29
289 posts

Sometimes you may want to temporarily store a variable for a short amount of time without writing a value to the database. Expression Engine’s sessions do not allow this, however PHP’s native sessions do.

This plugin allows you to use PHP’s native session variables.

http://www.putyourlightson.net/projects/session_variables

 Signature 


Add-ons: Developer, Expresso, FireMail, Sitemap Module, Snaptcha, Responsive CP, Multi Language Module and more

 
Posted: 12 May 2008 06:57 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2006-04-15
12649 posts

Hi Ben,

Can’t believe this one slipped me by! Looks really handy. Going to check it out now. Thanks for all the great items you make for ExpressionEngine, they are really great.

Just to echo the sentiments of Julien on your comments on your site it would be great if you could somehow loop over items to add and retrieve from the sessions. This could then possibly be the basis of a sort of shopping cart or something like that? At the moment you would have to name the variables with a counter or something and track the count I suppose?

Anyway thanks for this as I am going to try it out right away.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin | Full List Of Add-Ons | About Me
——————————————————————————————
2.x Bug Tracker | Upgrade Errors

 
Posted: 12 May 2008 07:01 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2007-09-29
289 posts

cheers mark, i appreciate it!

i find this one really handy, though i think most people haven’t really considered the possible uses of it.  only thing that bugs me sometimes is that the default lifetime of a php session is 24 minutes

 Signature 


Add-ons: Developer, Expresso, FireMail, Sitemap Module, Snaptcha, Responsive CP, Multi Language Module and more

 
Posted: 12 May 2008 07:20 AM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2006-04-15
12649 posts

Yep 24 minutes does seem a little odd although luckily on the server I am on I have full control over that sort of thing so would probably set it a lot higher than that.

Any thoughts on doing something like a shopping cart with this. What I mean to say is how hard would it be to add items to say something like an array in a session so that you can then just pull them all back at the end to show them in the cart and then send them off to say PayPal with the correct information?

Best wishes,

Mark

 Signature 

Shopping Cart Plugin | Full List Of Add-Ons | About Me
——————————————————————————————
2.x Bug Tracker | Upgrade Errors

 
Posted: 12 May 2008 07:27 AM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Avatar
Joined: 2007-09-29
289 posts

no reason why that wouldn’t work.  i reckon a cookie might be better though so that next time the visitor comes to the site their cart contents will still be there.  plus the lifetime of a cookie can be set to anything, including never-ending

 Signature 


Add-ons: Developer, Expresso, FireMail, Sitemap Module, Snaptcha, Responsive CP, Multi Language Module and more

 
Posted: 15 June 2009 07:05 PM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Joined: 2006-11-06
420 posts

I’m getting an error:

Cannot send session cookie headers already sent by (output started at /path.php:14in pi.session_variables.php on line 48 
 
Posted: 01 March 2010 09:24 PM   [ Ignore ]   [ # 6 ]   [ Rating: 0 ]
Joined: 2010-01-31
22 posts

Hi there,

The plugin is not showing up in my plugin list.  I’ve got plenty of other plugins installed correctly in EE2.0, but this one isn’t appearing.

Thanks.

 
Posted: 01 March 2010 09:29 PM   [ Ignore ]   [ # 7 ]   [ Rating: 0 ]
Joined: 2010-01-31
22 posts

Sorry.  Problem solved.

For some reason, permissions were not set correctly on that upload.  All is well.

Thanks for the plugin!

 
Posted: 26 March 2010 06:40 PM   [ Ignore ]   [ # 8 ]   [ Rating: 0 ]
Avatar
Joined: 2007-01-22
248 posts

I have a scenario where the front page will give the user two options.

If they choose option 1 I want them to have a blue logo whilst they surf the site.

If they choose option 2 I want them to have a silver logo whilst they surf the site.

Would this do the job?

 Signature 

euanross.com    @euanross

 
Posted: 26 March 2010 06:52 PM   [ Ignore ]   [ # 9 ]   [ Rating: 0 ]
Avatar
Joined: 2007-03-18
486 posts

That sounds like the perfect use of a cookie, Euan.

 Signature 

Follow me on Twitter: twitter.com/mrw

Note: I used to be slapshotw on this forum.