Cache-block and ezhttp get variables problem

Author Message

Radek Kuchta

Thursday 29 November 2007 12:47:41 am

I have a problem with a cache-block and ezhttp variables.
I have a tamplate where I'm using these ezhttp get variables (with my form) and the teplate has view cache disabled.

{set-block scope=root variable=cache_ttl}0{/set-block}

Everything works ok but when I'm displaing the page with my form and variables, everytime I have 23 sql queries. I would

like to have less so I used the cache-block with array keys as my http get variable. Unfortunately cache-block doesn't

work as I expected.

{cache-block key=array($offest, $get1, $get2, $get3, $get4 )}
... form and results ...
{/cache-block}

Once the viewed page has been displayed, I keep geeting the same result, even if the cache keys ($get1, $get2 etc...) change. Just as if they were not used.

Is it possible to use cache-block with that (eZ 3.10.0)?

http://ez.no/certification/verify/272582

Hans Melis

Thursday 29 November 2007 2:44:37 am

First thing I notice (it could just as well be a typo in your post) is that you use <b>key=</b> in the cache block statement, but the documentation says it's <b>keys=</b>.

If the typo is only in your post, what is the value of $get1 to $get4? Do those variables contain the name of the GET variable or do they contain the value of the GET variable?

Hans
http://blog.hansmelis.be

Paul Leclercq

Thursday 29 November 2007 3:14:08 am

personnaly I would drop the idea of using that line altogether:
{set-block scope=root variable=cache_ttl}0{/set-block}

This will simply remove the cache on your page, and will really require far too much processing power on your servers. and then re-include the cache manually, for a set of area.

You would be better off, converting your parameters into view_parameters if you can:
http://ez.no/doc/ez_publish/technical_manual/3_10/templates/basic_template_tasks

Or create a module view extension to collect the information from your form. That way you can collect the information in the script of the page, and cache the result page.
http://ez.no/fr/ezpublish/documentation/development/extensions/building_an_ez_publish_module

If you really want to use cache blocks, you would be better of using it the other way round. use a cache-block to unset the cache for one area, not for the entire page and then ressetting it for every part.

Radek Kuchta

Thursday 29 November 2007 3:20:39 am

Hi Hans,

Statement "key" was a typo only. I'm using keys array.

$get1 - $get4 variables contain the value of ezhttp get variable (if it is set, if no then the value is eq 0). For exemple code before cache-block:

{if ezhttp_hasvariable( 'name_1, 'get' )}
	{set $get1 = ezhttp( 'name_1', 'get' )}
{else}
	{set $get1 = 0}
{/if}

http://ez.no/certification/verify/272582

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.