Forums / General / [Solved] Problem with View Parameters and Cache

[Solved] Problem with View Parameters and Cache

Author Message

Benjamin Lorteau

Wednesday 01 July 2009 6:38:43 am

Hello everybody,

Today I have a problem with between view_parameters and the caching system. I know for sure that a cached version of the content is created for each call with different view parameters. With this, one can make a pagination inside a container node view.

But in my today's case, when I enable the cache and click on a page number (given by the standard navigator/google.tpl), it always displays the first page.

I thought it was on the fetch level, but all seems fine as it works without caching enabled. Then I checked the value of the variable I compute from the view parameter offset, and it doesn't change when calling the page with or without view parameters. So I figured that it was the computation caching that froze the offset.

Then I checked the $view_parameters.offset value itself just to make sure, and the value doesn't change either !

So, after I clear the view cache, if I click on "http://.../Node/(offset)/30" link, the $view_parameters.offset value is correct (at 30), but if I click immediately after on the "http://.../Node" link, the $view_parameters.offset value stays at 30.

Vice versa, if I clear the cache, click on "http://.../Node" link, the $view_parameters.offset value is correct (at 0), and then if I click on "http://.../Node/(offset)/30" link, the value stays at 0.

I searched thoroughly the forum for an answer, but I didn't find the same exact problem. Usually it's problems like "$view_parameters missing in included templates" or "Limit and Offset parameters missed in fetch".

What should I check now to make sure it's not a bug but (probably) a miss from me ?

(The pagination works perfectly in admin panel, with cache enabled)

eZ Publish personal project : http://www.aeriesguard.com [fr]

André R.

Wednesday 01 July 2009 8:00:35 am

Look true your code and see if there is any unclosed cache-block's or if you on purpose have a cache block around the code that use the view parameter.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Benjamin Lorteau

Thursday 02 July 2009 2:23:09 am

Thanks for your reply, André.

I checked pagelayout.tpl, the only place where cache-block would have been defined, although I didn't remember adding any cache-blocks and... shazam !

I wrote my pagelayout from the ezwebin pagelayout, but I forgot to check the cache-blocks closure once my modifications made.

Thanks a lot for your perspicacity, and shame on me for not using existant pagelayout properly.

eZ Publish personal project : http://www.aeriesguard.com [fr]