Storing session variables with PHP’s native sessions
Posted: 07 April 2008 01:32 PM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  208
Joined  09-29-2007

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 

* Get the Sitemap Module and improve your site’s SEO

More Add-ons: Multi Language, Exchange Rates, Stand-Alone Image Editor, Landing Page, iWebApp, LogMeIn, Loop Plugin, Session Variables

Profile
 
 
Posted: 12 May 2008 03:57 AM   [ Ignore ]   [ # 1 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9249
Joined  04-15-2006

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
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 12 May 2008 04:01 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  208
Joined  09-29-2007

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 

* Get the Sitemap Module and improve your site’s SEO

More Add-ons: Multi Language, Exchange Rates, Stand-Alone Image Editor, Landing Page, iWebApp, LogMeIn, Loop Plugin, Session Variables

Profile
 
 
Posted: 12 May 2008 04:20 AM   [ Ignore ]   [ # 3 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9249
Joined  04-15-2006

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
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 12 May 2008 04:27 AM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  208
Joined  09-29-2007

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 

* Get the Sitemap Module and improve your site’s SEO

More Add-ons: Multi Language, Exchange Rates, Stand-Alone Image Editor, Landing Page, iWebApp, LogMeIn, Loop Plugin, Session Variables

Profile
 
 
Posted: 15 June 2009 04:05 PM   [ Ignore ]   [ # 5 ]  
Research Assistant
RankRankRank
Total Posts:  507
Joined  11-05-2006

I’m getting an error:

Cannot send session cookie - headers already sent by (output started at /path.php:14) in pi.session_variables.php on line 48
Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 77511 Total Logged-in Users: 31
Total Topics: 101526 Total Anonymous Users: 17
Total Replies: 544279 Total Guests: 283
Total Posts: 645805    
Members ( View Memberlist )