CJW Network Home

eZPreference and his cache problems

Thursday September 20 2012: Tino Maaß

eZPreference and his cache problems

How works the ezpreference - operator and what cache problems exists?

How works it?

Okay, you develope an ez page and a visitor can choose between some settings on the page to customize it for himself.

Some examples are: hide / show some blocks; Count of thumbnails for a gallery; Bookmarks;

How we set a new ezpreference value?





The visitor take a decision between show or hide a special menu, in duration of his session.

How you get the value of your new preference ( in a template )?

{ezpreference(  'show_menu_x'  )}

What does the eZCache? Yes ... its cached the value of the preference :-(

How you solved this?


Set a new cache key!

{cache-block keys=array( ezpreferences( 'show_menu_x' ), ... )}CONTENT{/cache-block}


Take a look at the site.ini [ContentSettings] of your ez admin siteaccess! There exists an ini-parameter for ezpreference's. Use it in your user siteaccess settings!


You define the view ( "full" ), the name of your new preference ( "show_menu_x"  ) and the default value ( "true" ).

At least, you refresh the eZCache and it works fine now!

Coolscreen.de - internet development, audits and consulting Jac Systeme - software development, support and maintenance Webmanufaktur - alles ausser gewöhnlich eZ Publish Silver Partner