Using $node.name in pagelayout.tpl

Author Message

Trond Åge Kvalø

Wednesday 18 August 2004 7:20:09 am

On a website I made with eZ Publish 3.3-4 I used

<title>MySite :: {$node.name}</title>

to make nice dynamic titles.

Now in eZ Publish 3.4-0 i get the following error message when I try the same thing:

<b>Error:</b> eZTemplate @ design/microtech/templates/pagelayout.tpl:5[34]
Unknown template variable 'node' in namespace ''

How come?

trondåge

trondåge

Ole Morten Halvorsen

Wednesday 18 August 2004 7:28:11 am

Trond,

In older versions $node was available in pagelayout, but was not really supposed to. This bug has been fixed in the latest versions. If you want the current node you can fetch it:

{let curr_node=fetch( content, node, hash( node_id, $module_result.node_id ) )}

Ole M.

Senior Software Engineer - Vision with Technology

http://www.visionwt.com
http://www.omh.cc
http://www.twitter.com/omh

eZ Certified Developer
http://ez.no/certification/verify/358441
http://ez.no/certification/verify/272578

Trond Åge Kvalø

Thursday 19 August 2004 1:18:11 am

Thank you Ole Morten.

I'll change the other pagelayout.tpl as well then :-) Then it'll be possible to upgrade that site too.

Just to make sure I've understood this correctly, the following code should work, right?

{let curr_node=fetch( content, node, hash( node_id, $module_result.node_id ) )}
<title>MySite :: {$curr_node.name}</title>
{/let}

best regards
trondåge

trondåge

Ole Morten Halvorsen

Thursday 19 August 2004 2:16:13 am

Yes, that should work. Please note this fetch will be empty on pages without a node such as /user/login.

Senior Software Engineer - Vision with Technology

http://www.visionwt.com
http://www.omh.cc
http://www.twitter.com/omh

eZ Certified Developer
http://ez.no/certification/verify/358441
http://ez.no/certification/verify/272578

Paul Forsyth

Thursday 19 August 2004 3:55:01 am

It would be nice if there was consistency with $node in pages. I filed this bug a while back about this:

http://ez.no/community/bug_reports/always_have_a_valid_node_object_available

paul

--
http://www.visionwt.com

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