ViewCaching and $view_parameters

Author Message

Michael Enger

Friday 24 June 2011 2:03:15 am

I've created a custom layout for handling AJAX requests which fetches content based on passed view parameters, but when ViewCaching is enabled the $view_parameters array only contains content the first time the layout is shown.

I call the address example.com/layout/set/ajax/(node_id)/155 and use the attribute operator to print out the contents of the $view_parameters array to test it, and it's clearly empty after the first time. I tried using a cache-block with the $view_parameters area as keys, but that doesn't help since the array becomes empty and using a static value for keys would mean that it will show the same content no matter what view parameters are sent to it.

I also tried to set the cache_ttl variable to 0, but to no avail.

Michael Enger

Friday 24 June 2011 3:45:27 am

Discovered what was wrong, thanks to a coworker of mine:

Apparently, the layout module gives you access to the GET parameters, but not the view parameters, which is the exact opposite of what the content module does. Great.

Gaetano Giunta

Saturday 25 June 2011 4:36:46 am

You might want to try out the ezwebservicesapi extension: it gives you webservice access to all existing fetch functions...

Principal Consultant International Business
Member of the Community Project Board

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 02:45:34
Script start
Timing: Jan 18 2025 02:45:34
Module start 'layout'
Timing: Jan 18 2025 02:45:34
Module start 'content'
Timing: Jan 18 2025 02:45:34
Module end 'content'
Timing: Jan 18 2025 02:45:34
Script end

Main resources:

Total runtime0.7744 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0081 587.9141152.6250
Module start 'layout' 0.00810.0029 740.539139.4531
Module start 'content' 0.01100.7620 779.9922537.9922
Module end 'content' 0.77290.0015 1,317.984412.1563
Script end 0.7744  1,330.1406 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.4769160.0002
Check MTime0.00140.1754160.0001
Mysql Total
Database connection0.00110.136710.0011
Mysqli_queries0.724693.5683570.0127
Looping result0.00080.1037550.0000
Template Total0.740295.620.3701
Template load0.00280.356020.0014
Template processing0.737595.226420.3687
Template load and register function0.00010.013310.0001
states
state_id_array0.00080.103910.0008
state_identifier_array0.00080.097620.0004
Override
Cache load0.00230.2944140.0002
Sytem overhead
Fetch class attribute can translate value0.00090.112620.0004
Fetch class attribute name0.00100.135550.0002
XML
Image XML parsing0.00100.126020.0005
class_abstraction
Instantiating content class attribute0.00000.001760.0000
General
dbfile0.00130.1616220.0001
String conversion0.00000.001340.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
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 11
 Number of unique templates used: 5

Time used to render debug report: 0.0002 secs