Is $node.node_id cleared on browser refresh?

Author Message

Barney Gumble

Thursday 15 January 2004 9:24:04 am

For one page on my site I want to add extra items to <HEAD> and also use a <BODY ONLOAD...>. I'm trying to do this in pagelayout.tpl as follows (I've taken out stylesheet calls etc.):

<html>
<head>
{section show=eq( $node.node_id, 44 ) )}
{* include call to javascript here *}
{/section}
</head>

{section show=eq( $node.node_id, 44 ) )}
<body onLoad=...>
{section-else}
<body>
{/section}
.
.
.

This works fine the first time, i.e. the extra script is used in the <HEAD>, and the <BODY ONLOAD...> is being used. However when I refresh the page in IE6 neither of these things are happening. In fact I can even see a normal <BODY> has been used. $node.node_id also appears to be blank, where it should be 44.

I'm using eZ publish 3.2.4. Any suggestions would be very welcome!

Paul Borgermans

Thursday 15 January 2004 10:10:51 am

In pagelayout.tpl files and their overrides you should use $module_result.node_id instead of $node.node_id. The latter is only available the first time you call the page with this node id.

In view templates for classes and their objects it is entirely safe to use $node.whatever

hth

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Barney Gumble

Thursday 15 January 2004 10:18:12 am

That's great, thanks Paul!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.