Sunday 28 January 2007 4:31:42 pm - 2 replies
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
Sunday 28 January 2007 7:59:28 pm
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/inst.../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
You must be logged in to post messages in this topic!