Folder attribute is empty when page is reloaded

Author Message

Andreas Tremel

Sunday 28 January 2007 7:31:42 am

Hello there!

I'm using EZ Publish v3.8.4.

My goal was to render dynamic meta descriptions for each page in the site.
Therefore I've created a new attribute and encountered an issue/bug? related to caching:

1. I've defined a new text line attribute named "my_attribute" in the folder class.
2. I created a new folder using "Text" as value for "my_attribute" in the backend.
3. I modified the "page_head.tpl" template like his:

<meta name="description" content="{$node.object.data_map.my_attribute.content}" />

When the folder is loaded for the first time in the frontend, the placeholder is filled correctly:

<meta name="description" content="Text" />

However, when the page is loaded for the second time, the placeholder is empty:

<meta name="description" content="" />

When I clear the site cache, the placeholder works. When the page is reloaded, the placeholder again is empty.
Same thing happens when I use another template (e.g. "pagelayout.tpl") or another attribute (e.g. "title").

Has anyone had familiar problems / know a solution? Thank you in advance.

Regards,

Andreas Tremel

Claudia Kosny

Sunday 28 January 2007 10:59:28 am

Hi Andreas

The variable $node is not available in pagelayout.tpl and related templates once a page is cached, so if you really need it, fetch the node at the beginning of pagelayout.tpl or page_head.tpl. Check e.g here: http://ez.no/community/forum/install_configuration/no_more_node_variable_in_pagelayout
(although this is for EZ 3.9, where $node apparently is not there even for the first page load, the solution is the same).

Claudia

Andreas Tremel

Monday 29 January 2007 6:59:03 am

Hi Claudia,

thanks a lot, now it works!

I've posted your solution into another thread, it seems that more useres have encountered the same problem.

Chers,
Andreas

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 15:14:39
Script start
Timing: Jan 18 2025 15:14:39
Module start 'layout'
Timing: Jan 18 2025 15:14:39
Module start 'content'
Timing: Jan 18 2025 15:14:39
Module end 'content'
Timing: Jan 18 2025 15:14:39
Script end

Main resources:

Total runtime0.7623 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.0054 589.1797152.6406
Module start 'layout' 0.00550.0036 741.820339.4922
Module start 'content' 0.00910.7521 781.3125474.2344
Module end 'content' 0.76110.0012 1,255.546912.1250
Script end 0.7623  1,267.6719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.3873160.0002
Check MTime0.00120.1572160.0001
Mysql Total
Database connection0.00110.142610.0011
Mysqli_queries0.717194.0598570.0126
Looping result0.00060.0760550.0000
Template Total0.733596.220.3667
Template load0.00190.247520.0009
Template processing0.731695.961120.3658
Template load and register function0.00020.021210.0002
states
state_id_array0.00110.143010.0011
state_identifier_array0.00100.136720.0005
Override
Cache load0.00150.2029310.0000
Sytem overhead
Fetch class attribute can translate value0.00050.068720.0003
Fetch class attribute name0.00120.152730.0004
XML
Image XML parsing0.00020.032420.0001
class_abstraction
Instantiating content class attribute0.00000.001330.0000
General
dbfile0.00070.0931100.0001
String conversion0.00000.001140.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/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.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: 5

Time used to render debug report: 0.0001 secs