Storing session variables with PHP’s native sessions
Posted: 07 April 2008 02:32 PM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  147
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: iWebApp, Stand-Alone Image Editor, Landing Page, LogMeIn, Loop Plugin, Session Variables

Profile
 
 
Posted: 12 May 2008 04:57 AM   [ Ignore ]   [ # 1 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4897
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 

Full List Of Plugins Here!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 12 May 2008 05:01 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  147
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: iWebApp, Stand-Alone Image Editor, Landing Page, LogMeIn, Loop Plugin, Session Variables

Profile
 
 
Posted: 12 May 2008 05:20 AM   [ Ignore ]   [ # 3 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4897
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 

Full List Of Plugins Here!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 12 May 2008 05:27 AM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  147
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: iWebApp, Stand-Alone Image Editor, Landing Page, LogMeIn, Loop Plugin, Session Variables

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 10:33 AM
Total Registered Members: 60714 Total Logged-in Users: 25
Total Topics: 73170 Total Anonymous Users: 18
Total Replies: 394632 Total Guests: 486
Total Posts: 467802    
Members ( View Memberlist )