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.

eZ debug

Timing: Jan 18 2025 22:21:48
Script start
Timing: Jan 18 2025 22:21:48
Module start 'layout'
Timing: Jan 18 2025 22:21:48
Module start 'content'
Timing: Jan 18 2025 22:21:49
Module end 'content'
Timing: Jan 18 2025 22:21:49
Script end

Main resources:

Total runtime0.8240 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 588.9063152.6094
Module start 'layout' 0.00470.0030 741.515639.4063
Module start 'content' 0.00780.8147 780.9219530.1328
Module end 'content' 0.82240.0015 1,311.05478.2031
Script end 0.8239  1,319.2578 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.3893160.0002
Check MTime0.00150.1771160.0001
Mysql Total
Database connection0.00050.059810.0005
Mysqli_queries0.769193.3428540.0142
Looping result0.00040.0541520.0000
Template Total0.795596.520.3977
Template load0.00170.203920.0008
Template processing0.793896.339320.3969
Template load and register function0.00010.018010.0001
states
state_id_array0.00070.085910.0007
state_identifier_array0.00130.159120.0007
Override
Cache load0.00140.1678230.0001
Sytem overhead
Fetch class attribute can translate value0.00190.231720.0010
Fetch class attribute name0.00110.131330.0004
XML
Image XML parsing0.00891.082420.0045
class_abstraction
Instantiating content class attribute0.00000.000930.0000
General
dbfile0.00861.0478160.0005
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 18
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs