CodeIgniter Forums
Anyone using the session library just for the flashdata? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Anyone using the session library just for the flashdata? (/showthread.php?tid=31062)

Pages: 1 2


Anyone using the session library just for the flashdata? - El Forum - 06-05-2010

[eluser]nuwanda[/eluser]
I'm using native PHP sessions but find the flashdata methods really handy.

Of course that means I'm autoloading the CI session library to take advantage of the flashdata methods.

That means I'm loading a script and only using part of it's functionality.

I messed around with passing session vars to my views but the flashdata is really nice. Ya know, one less problem.

Anyone got the same setup? Any better way to do it?


Anyone using the session library just for the flashdata? - El Forum - 06-05-2010

[eluser]skunkbad[/eluser]
[quote author="nuwanda" date="1275748441"]I'm using native PHP sessions but find the flashdata methods really handy.

Of course that means I'm autoloading the CI session library to take advantage of the flashdata methods.

That means I'm loading a script and only using part of it's functionality.

I messed around with passing session vars to my views but the flashdata is really nice. Ya know, one less problem.

Anyone got the same setup? Any better way to do it?[/quote]

This is exactly what I do. I don't feel that using CI sessions gives me the same functionality that $_SESSION does, but using the flash sessions of CI is pretty handy. If I took time to make a flash session for $_SESSION, then I wouldn't need CI sessions at all!


Anyone using the session library just for the flashdata? - El Forum - 06-07-2010

[eluser]n0xie[/eluser]
[quote author="skunkbad" date="1275781815"]I don't feel that using CI sessions gives me the same functionality that $_SESSION does[/quote]
Wait what...?


Anyone using the session library just for the flashdata? - El Forum - 06-07-2010

[eluser]skunkbad[/eluser]
[quote author="n0xie" date="1275922319"][quote author="skunkbad" date="1275781815"]I don't feel that using CI sessions gives me the same functionality that $_SESSION does[/quote]
Wait what...?[/quote]

$_SESSION (by default) destroying itself on browser close is just one example.

Why try to improve something that works perfectly?


Anyone using the session library just for the flashdata? - El Forum - 06-07-2010

[eluser]danmontgomery[/eluser]
http://codeigniter.com/wiki/Native_session/


Anyone using the session library just for the flashdata? - El Forum - 06-07-2010

[eluser]skunkbad[/eluser]
[quote author="noctrum" date="1275951715"]http://codeigniter.com/wiki/Native_session/[/quote]

Maybe someday I will use something like this.


Anyone using the session library just for the flashdata? - El Forum - 06-07-2010

[eluser]WanWizard[/eluser]
[quote author="skunkbad" date="1275951183"]$_SESSION (by default) destroying itself on browser close is just one example.
Why try to improve something that works perfectly?[/quote]
Depends on your definition of perfectly.

I personally can't appreciate it when a server makes decisions for me. And I have plenty of examples where destroying the session on browser close is not a good idea...

With the session library I can decide (or in this case the admin of our CMS) when to have the session expire.


Anyone using the session library just for the flashdata? - El Forum - 06-07-2010

[eluser]skunkbad[/eluser]
[quote author="WanWizard" date="1275952952"][quote author="skunkbad" date="1275951183"]$_SESSION (by default) destroying itself on browser close is just one example.
Why try to improve something that works perfectly?[/quote]
Depends on your definition of perfectly.

I personally can't appreciate it when a server makes decisions for me. And I have plenty of examples where destroying the session on browser close is not a good idea...

With the session library I can decide (or in this case the admin of our CMS) when to have the session expire.[/quote]

If you want to have $_SESSION extended past browser close, you simply use session_set_cookie_params(). The server never makes decisions for you, and this session_set_cookie_params() function allows for a persistent cookie! Yay for $_SESSION!


Anyone using the session library just for the flashdata? - El Forum - 06-07-2010

[eluser]nuwanda[/eluser]
Yes, if setting the CI session duration to 0 killed the session on browser close, it would be perfect.


Anyone using the session library just for the flashdata? - El Forum - 06-07-2010

[eluser]skunkbad[/eluser]
[quote author="nuwanda" date="1275968015"]Yes, if setting the CI session duration to 0 killed the session on browser close, it would be perfect.[/quote]

I don't know... I still like my session data to live on the server, and CI's session data lives in the browser. This can result in behavior that is different depending on usage.