Share » Forums » Install & configuration » No more $node variable in pagelayout

No more $node variable in pagelayout

No more $node variable in pagelayout

Wednesday 17 January 2007 2:03:58 am - 2 replies

Author Message

André R.

Wednesday 17 January 2007 3:50:18 am

$node is still available in node templates, but from 3.9 and higher it is removed from pagelayout and related templates.
This is with good reason since $node is not set in pagelayout when viewcache is turned on and you are viewing a cached node page, and it's never set in pagelayout on pages that are not content related.

So if you need to use current node in your pagelayout, do something like this:

{def $current_node_id  = first_set($module_result.node_id, 0)}
{if $current_node_id}
{def $current_node = fetch( content, node, hash( node_id, $current_node_id ) )}
{/if}

If you absolutely need $node present in your pagelatout:

{if and( is_set($module_result.node_id), is_unset($node) )}
{def $node = fetch( content, node, hash( node_id, $module_result.node_id ) )}
{/if}

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Andreas Adelsberger

Wednesday 17 January 2007 4:31:45 am

ah, thank you very much. now i understand.

---------------------------------------
Styleflasher New Media OG
Websites. Games/Multimedia.

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu