This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » fetch not working in page_head.tpl

fetch not working in page_head.tpl

fetch not working in page_head.tpl

Friday 05 September 2008 2:15:18 pm - 4 replies


I have small problem that is about to drive me mad. While trying to implement meta keywords in the html header I tried to fetch the keywords of the currently viewed node. As I need to do that in the page header I include it with a parameter that contains the current node id.


{include uri="design:page_head.tpl" current_node_id=$module_result.node_id}

(I was not sure about whether module_result is accessible in templates included from pagelayout.tpl so I supplied the parameter just to be sure). In page_head.tpl I can print the node id but fetching that node to get to the data map etc fails on most objects.


{def $node=fetch('content','node',hash('node_id',$current_node_id))}

it fails with articles, news and other content objects but works with folders for instance. It is even more disturbing as that same code works on another siteaccess (even without passing a parameter). Any hint on what's going on here is appreciated.


Modified on Friday 05 September 2008 2:16:29 pm by Oliver Frommel

Monday 08 September 2008 5:12:52 pm


I never had this sort of problem, but I always use:


I know that in theory it's the same but try it, maybe this will work


Modified on Monday 08 September 2008 5:13:23 pm by Pierre Tissot

Thursday 11 September 2008 9:06:06 am

Thanks for the hint. Only it doesn't help because the node_id I get is always ok. It's only the fetch that fails.

Monday 15 September 2008 3:16:43 pm

Have you checked that the include is not inside any cache-block? this can cause symptoms like yours...


Monday 15 September 2008 4:41:58 pm

Unfortunately not. Thanks for the proposal however. The strange thing is that only the fetch fails. I will just paste the few code lines in question:

{def $active_node_id=$module_result.node_id
     $node=fetch('content','node',hash('node_id', $active_node_id))}

"{$}" - "{$active_node_id}"

The node id is always shown, the name isn't in most cases. It works only with folders.
Now I am beginning to think that it has to do with localisation, maybe.


Modified on Monday 15 September 2008 4:42:42 pm by Oliver Frommel


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

36 542 Users on board!

Forums menu

Proudly Developed with from