Forums / Setup & design / Empty Top Level Content Node (NodeID: 2)

Empty Top Level Content Node (NodeID: 2)

Author Message

Paul Brandt

Wednesday 13 September 2006 6:27:54 am

For some reason I cannot access the top level content node, NodeID=2, whilst in the admin interface there are several folders present as child nodes.

My objective is to build a navigation tree, based upon the content node tree (hey, don't we all....).

Running the following code in the pagelayout.tpl

<p>current node_id: {$module_result.node_id}</p>
{$module_result.node_id|attribute( show, 3 )}

<i>Treemenu operator result:</i>
{def $menus=treemenu( $module_result.path, 2) }
   {section name=topMenu loop=$menus}
   <a href={$topMenu:item.url_alias|ezurl}
      title="{$topMenu:ite.text}">{$topMenu:item.text}</a>
   {/section}
{undef $menus}

<b>Next Paragraph</b>

results in:
current node_id: 2
<b>Attribute Type Value</b>

<i>Treemenu operator result:</i>

<b>Next Paragraph</b>

This is weird, especially since the admin interface confirms node 2 has got 9 subitems (all folders). It further indicates:
Visibility: Visible
Section: Standard
Node ID: 2
Object ID: 147
Author: administrator
Location: LedenWeb (= the name of the top level content node)

I'm running ezPublish version 3.6.3

Anyone any idea what I'm doing wrong here (and even better: has got a solution to this)?

Thanks in advance
Paul

Claudia Kosny

Wednesday 13 September 2006 6:58:55 am

Hi Paul

Does it work when you add an array('folder') or similar as class_filter?

Claudia

Paul Brandt

Wednesday 13 September 2006 8:09:43 am

Hi Claudia,

Nope, class filter set to 'folder' doesn't help.

In addition, the same behaviour applies for all other nodes as well, hence it is not restricted to the top level content node alone. Leading to the conclusion that maybe the source of the problem is not related to seemingly empty nodes at all; maybe the variable '$module_result' isn't initialized correctly...

If I apply another example for building navigation menus, some output <b>is</b> generated:

{let folder_list=fetch( content, list, hash(parent_node_id, 2, sort_by, array( array( priority ))))}

    <ul>
    {section name=top_level loop=$folder_list}
        <li><a href={concat("/",$top_level:item.url_alias)|ezroot}>{$top_level:item.name|wash}</a>
        {section show=$top_level:item.node_id|eq($module_result.path[1].node_id}
            {let sub_folder_list=fetch( content, list, hash(parent_node_id, $module_result.path[1].node_id, sort_by, array( array( priority ))))}
            <ul>
                {section name=sub_level loop=$top_level:sub_folder_list}
                <li><a href={concat("/",$top_level:sub_level:item.url_alias)|ezroot}>{$top_level:sub_level:item.name|wash}</a></li>
                {/section}
            </ul>
            {/let}
        {/section}
        </li>
    {/section}
    </ul>
{/let}

This results (for nodeID: 2) in:

<ul>
      <li><a href="/~intranet/index.php/verenigingszaken">Verenigingszaken</a>
           <ul></ul>
      </li>
      <li><a href="/~intranet/index.php/de_nmv_kennisbank">De NMV-Kennisbank</a>
           <ul></ul>
      </li>
      .... etc ....
</ul>

So: Why doesn't the 'treemenu' operator behaves like the 'fetch' operator although they operate on the same node? Or don't they operate on the same node?

Again, thanks in advance. I'm really stuck here.
Paul

Claudia Kosny

Wednesday 13 September 2006 1:51:50 pm

Hi Paul

you can easily check the content of $module_result.path using the |attribute function
The output for node 2 should be something like this:

0 	array 	Array(4)
>text 	          string 	'eZ publish'
>url 	           boolean 	  false
>url_alias 	boolean 	false
>node_id 	string 	         2

Unfortunately I do not have a EZ 3.6 to test so I cannot help you much further with this. On my EZ 3.8.3 I do always have to state a classfilter which related to this bug http://ez.no/community/bugs/warnings_when_using_treemenu_without_class_filter_parameter
Anyhow - if you are interested in solving your problem I would suggest checking the file \kernel\common\eztreemenuoperator.php. For the most part it is pretty straightforward so you can see what is actually happening.

Claudia

Paul Brandt

Thursday 14 September 2006 1:37:02 am

Hi Claudia,

Thanks for your response. Apparently I made a dumb typo of some sort since the <i>treemenu</i> operator now behaves correctly when provided with an <i>array('folder')</i> class_filter, circumventing the bug you so kindly informed me about. So, all is well.

All is well? Well not entirely!
"One small village of indomitable Gauls still holds out against the invaders..." ;-)

Jokes aside: for some reason the attribute operator still doesn't want to show anything. The following code:

{$module_result.node_id|attribute( 'show' )}

 

results in an empty list:
<b>Attribute Type Value</b>

and that's all.
Am I experiencing a bug, or do I belong to the majority that should RTFM somewhat better?

Thanks in advance
Paul

Kristof Coomans

Thursday 14 September 2006 7:20:00 am

$module_result.node_id is an integer, not an object or array, that's why you won't get anything with attribute(show)

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org