Cache problem

Author Message

Fabien Mas

Tuesday 24 July 2007 12:20:41 am

Hi
I would like to put a randomized article in my front page.
So I need to create a new template which is not cached to change each time the randomized article.
But I can't find a way ...

here is my pageloayout.tpl

... {cache-block keys=array($uri_string)}
        .... {include uri='design:my_area.tpl' area=$iag_bottom position='Bottom'} ...
{/cache-block}

here is : my_area.tpl

{section var=tool loop=$area}
  {let tool_template='design:area/'|concat($tool.template)}
    {* I CALL HERE MY RANDOMIZED ARTICLE *}
    {include uri=$tool_template elt=$tool.elt position=$position
             contextual=$tool.contextual}
  {/let}
{/section}

And now here is : randomized_article.tpl

{set-block scope=root variable=cache_ttl}0{/set-block} 
{cache-block keys=array($elt.main_node_id,"article_aleatoire") expiry=1}
	{def $list_count=fetch('content', 'list_count', hash(parent_node_id, $elt.main_node_id))
		 $aleat=rand(0,sub($list_count,1))
		 $random=fetch('content','list',hash(parent_node_id,$elt.main_node_id,
		     								limit,1,
		     								offset,$aleat))}								
	<div id="zoom_random">	     								
		{node_view_gui content_node=$random[0] view=line}
	</div>
	
	{undef $list_count $aleat $random}
{/cache-block}

I tried a lot of different codes, but nothing is working ..

thx for any help
Fabien

Donat Fritschy

Friday 27 July 2007 9:51:43 am

Hi Fabien

The outer cache block caches everythig inside, wether this itself is cached or not.

Try using two cache blocks: one above, one below the uncached segment.

Regards
Donat

http://www.webmanufaktur.ch - Developers united in eZ Publish: http://www.cjw-network.com

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