fetch inside of fetch...

Author Message

Bojan Segic

Monday 13 November 2006 7:22:40 am

Hi I'm trying to fetch content insade of fetch. I've written the following code :

{let children=fetch( content, list, hash( parent_node_id, $node.node_id,
sort_by, $node.sort_array,
) )}

{* LOOP: For each child of the node... *}
{section name=Child loop=$children}


{node_view_gui view=line content_node=$Child:item}
{attribute_view_gui attribute=$:item.object.data_map.title}
{attribute_view_gui attribute=$:item.object.data_map.body}
{$:item.object.data_map.headline.content|wash}

{if eq( $:item.class_identifier, 'table2' )}


{let nebojsa=fetch( content, list, hash( parent_node_id, $:item.node_id,
sort_by, $node.sort_array,
) )}

{* LOOP: For each child of the node... *}
{section name=Child1 loop=$nebojsa}
<p>{attribute_view_gui attribute=$:item.object.data_map.column1}</p>
<p> {attribute_view_gui attribute=$:item.object.data_map.column2}</p>
{/section}
{/let}

{/if}

{* End of loop. *}
{/section}
{/let}

Doesn't work! Any idea?

Thanks in advance

Claudia Kosny

Tuesday 14 November 2006 1:45:17 pm

Hi Bojan

Enable debug output and check whether you get any interesting messages there.
Also try the outer loop first - does this work as expected on its own?
Also please note that looping with a section is deprecated. You should replace this with a foreach: http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_control_structures/looping/foreach

If the debug messages do not help you please post again. But in this case please tell us:
- what exactly does not work (what should happen, what happens instead...)
- what debug messages you get (if any)
- what version of EZ you use

Also please use code tags to surround your code when posting (see description on the right of the textarea when you post something) and indent the code a bit, this makes it much easier to read.

Greetings from Luxembourg

Claudia

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