Forums / Developer / Best way for session preferences

Best way for session preferences

Author Message

Karol Radziuk

Tuesday 22 February 2011 2:56:51 am

Hi

I'd like to give for anonymus user an opportunity to store:
- numer of items per page (10, 20, 50...)
- sorting method

Ez preference stores data per user id. Each anonymus has the same id...

$view_parameters is not good, system will not remember user's decision. Session variable seems to be best, but how to store it easly, and deal with template cache?

Have you an idea, how to do this smoothly?

{$me|attribute(show,1)}

Damien Pobel

Tuesday 22 February 2011 4:27:28 am

Hi,

"

Ez preference stores data per user id. Each anonymus has the same id...

"

In fact the preference system of eZ Publish is bit more clever because for anonymous users it uses session variables instead of storing values in the database. See https://github.com/ezsystems/ezpublish/blob/master/kernel/classes/ezpreferences.php

Cheers

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish