view cache trouble

Author Message

Gabriel Ambuehl

Friday 09 December 2005 2:43:03 am

I'm wrestling with cache blocks in a full template for a certain node. Specifically, I want the cache to be based on url, user and a ezpreference parameter:

So I use

{array($uri_string,$current_user.contentobject_id, ezpreference('forumlook'))|attribute(show)}

in the template, but whenever I have view cache active, I always get

Attribute 	Type 	Value
0 	NULL 	
1 	NULL 	
2 	string 	$whateverwasselectedatlastcacheclean

My pagelayout doesn't have a cache block around module_result so I can't figure out why the above doesn't always get updated?` (If I disable the view cache, ezpreference will work but the two other strings still are even though the cache-block doc specifically mentions them to cache based on URI and user).

Visit http://triligon.org

Łukasz Serwatka

Friday 09 December 2005 2:54:11 am

Did you disable view cache for this template? Put in first line of this template file code

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

Then use cache-blocks.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Gabriel Ambuehl

Friday 09 December 2005 3:01:23 am

Of course, that's what I forgot.

It should DEFINITELY be noted on the cache-block doc page. ;)

Thanks, luke ;)

Edit: Remains the question as to why the two first params are null...

Visit http://triligon.org

Kristian Hole

Friday 09 December 2005 5:18:57 am

Remember that the $uri_string and $current_user is only avaiable in a pagelayout template, not in the node-view templates.

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

Gabriel Ambuehl

Friday 09 December 2005 5:33:54 am

Ok, so I'll have to use other measures ;)

Visit http://triligon.org

André R.

Tuesday 16 October 2007 12:57:10 am

For future reference and since it doesn't seem to be documented, heres a list of the variable's that are supposed to be set in node templates:

$node (you should know this from before..  :)  )
$viewmode (the view mode, full, line, plain, etc.)
$language_code (the language code, probably added/updated around v3.8)
$view_parameters (the view parameters: limit, offset, custom stuff, etc.)
$collection_attributes (related to info collection)
$validation (probably related to info collection)
$persistent_variable (usually false)
$node_path (the node-path to a long and healthy life)

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

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 19 2025 01:20:53
Script start
Timing: Jan 19 2025 01:20:53
Module start 'layout'
Timing: Jan 19 2025 01:20:53
Module start 'content'
Timing: Jan 19 2025 01:20:54
Module end 'content'
Timing: Jan 19 2025 01:20:54
Script end

Main resources:

Total runtime0.7902 sec
Peak memory usage4,096.0000 KB
Database Queries70

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0074 589.0391152.6094
Module start 'layout' 0.00740.0025 741.648439.4297
Module start 'content' 0.01000.7787 781.0781659.8672
Module end 'content' 0.78870.0015 1,440.945316.1875
Script end 0.7901  1,457.1328 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.3871160.0002
Check MTime0.00130.1609160.0001
Mysql Total
Database connection0.00100.121210.0010
Mysqli_queries0.723291.5255700.0103
Looping result0.00090.1202680.0000
Template Total0.753295.320.3766
Template load0.00190.239120.0009
Template processing0.751395.073220.3756
Template load and register function0.00030.034510.0003
states
state_id_array0.00070.087710.0007
state_identifier_array0.00140.179920.0007
Override
Cache load0.00160.2065280.0001
Sytem overhead
Fetch class attribute can translate value0.00070.087040.0002
Fetch class attribute name0.00220.272490.0002
XML
Image XML parsing0.00180.233040.0005
class_abstraction
Instantiating content class attribute0.00000.002490.0000
General
dbfile0.00470.5976310.0002
String conversion0.00000.001040.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
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/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: 24
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs