Forums / Developer / newbie problems with fetch

newbie problems with fetch

Author Message

Carlos Campderrós

Saturday 29 July 2006 10:42:19 am

Hi all,

I'm just starting my first project with eZpublish, and just facing my first problem. I want to fetch the latest "Release_middleware" object stored on the "releases" folder (Node ID == 60). Here is the full code of my "sidebar_releases.tpl" template, called from "full_view_portada.tpl", an override from the full view template:

{let children=fetch('content', 'list', hash (
    'parent_node_id', '60',
    'limit', 1,
    'class_filter_type', 'include',
    'class_filter_array', array('Release_middleware')
 ) )
}

<h1>foo</h1>

{section name=Child loop=$children}
    <h2>bar</h2>
{/section}
{/let}

But I get an error:

Error: eZTemplate:let  	Jul 29 2006 12:34:21

parser error @ design/foobar/templates/sidebar_releases.tpl:4
Empty variable name at [('content', 'list', hash ( 
	'parent_node_id', '60',
	'limit', 1,
	'class_filter_type', 'include',
	'class_filter_array', array('Release_middleware')
 ) )
]

I'm stuck with this problem for the last two hours, I can't find a solution. Any help out there?

Kristian Hole

Saturday 29 July 2006 11:27:04 am

Hi Carlos,

Welcome to the forum!

For some reason eZ publish is picky about having a space between the functions and (. I think you get this error because you have a space between hash and (.

Btw, you can also write this in the "new" template syntax introduced in 3.5. Like this:

{def $children=fetch('content', 'list', hash(
   'parent_node_id', '60',
   'limit', 1,
   'class_filter_type', 'include',
   'class_filter_array', array('Release_middleware')
 ) )
}

<h1>foo</h1>

{foreach $children as $child}
   <h2>bar {$child.name}</h2>
{/foreach}

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

Carlos Campderrós

Saturday 29 July 2006 1:00:13 pm

Oh yes, that space was the problem. Thank you very much Kristian : )