Forums / Setup & design / $node no more accessable in 3.4? (am I dreaming?)

$node no more accessable in 3.4? (am I dreaming?)

Author Message

Stefano Guandalini

Thursday 05 August 2004 7:49:41 am

After upgrading from 3.3-5 to 3.4-1, I can no more use $node variable in pagelayout.tpl and in included tpls. I can access it only in overrided templates.

{$node.name}

does not produce any output and

{$node|attribute( '', 2 )

is empty!!!
Am I dreaming?

Thanks.

Bye

Stefano Guandalini
http://www.nizan.net

Paul Borgermans

Thursday 05 August 2004 8:25:22 am

Stefano,

$node is only available in content view templates, not pagelayout templates and its includes except when called the first time with view caching on or all the time with view caching off in the 3.3 series and before.

With 3.4 the caching has changed a bit

I suggest to create your own $currentnode variable based on $module_result.node_id

{let currentnode=fetch(content,node,hash(node_id,$module_result.node_id}
.....
{/let}

hth

-paul

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

Zoltan Szabo

Wednesday 11 August 2004 11:12:40 am

I had the same experience: "Am I dreaming?"
A lot of documentation page speaks about this $node thing...

A have a lot of problems with strange and un-decodeable variables in eZp, mainly in xml parts. How could I obtain some parts of the xml text without using the builtin "content" possibilities?

Paul Borgermans

Wednesday 11 August 2004 11:31:22 am

There is no possibility out of the box to access xml parts of xml text fields.

However, you may achieve something by either

- use the xslt operator from the contributions to transform/select part of the xml content
- fetch the raw xml content and use javascript DOM on it

-paul

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