Forums / Setup & design / Extract Info from eZ

Extract Info from eZ

Author Message

Softriva .com

Wednesday 16 August 2006 12:29:02 am

Under node #2, there are three folders A, B, C and under each folder there are 5 folders i.e. A1, A2,....A5, B1, B2.....B5, etc.

How can I extract these folders and display them as

A
A1, A2, A3, A5, A5

B
B1, B2, B3, B4, B5

C
C1, C2, C3, C4, C5

I have start as follows:

{def $wa_node=fetch(content,list, hash(parent_node_id, 2))}

{foreach $wa_node as $menu}
{node_view_gui view=line content_node=$menu}
{/foreach}

{undef}

The above only print A, B, C

Clemens T

Wednesday 16 August 2006 1:31:29 am

Heeya Oozy,

Here's a summary of all kinds of fetch functions in eZ (for content that is).

http://ez.no/doc/ez_publish/technical_manual/3_8/reference/modules/content/fetch_functions

And the $wa_node is not even needed, here's my solution to your problem (it needs some work, but you get that the fetch content TREE does the trick, check the manual.. for more info):

{foreach fetch(content,tree, hash(parent_node_id, 2,
                                   depth, 2)) as $menu}
{node_view_gui view=line content_node=$menu}
{/foreach}

Have fun,
Clemens

Coulibaly Ibrahim

Wednesday 16 August 2006 1:55:37 am

if you want to undestand how it works

{def $wa_node=fetch(content,list, hash(parent_node_id, 2,
                                                                   class_filter_type, 'include', 
                                                                   class_filter_array, array('folder')))}

{foreach $wa_node as $menu}
<br />
{node_view_gui view=line content_node=$subFolder}{*print A, B, C....*}
    {def $subFolders=fetch(content,list, hash(parent_node_id,$menu.node_id,
                                                                   class_filter_type, 'include', 
                                                                   class_filter_array,array('folder')))
    }
    {foreach $subFolders as $subFolder}
              {node_view_gui view=line content_node=$subFolder} {*print A1,...A5, B1... B5..*}
    {/foreach}
    {undef $subFolders}
{/foreach}

{undef}

Hope it can help you ;)