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.