Forums / Setup & design / Expanding list, forgets its parent node and collapses

Expanding list, forgets its parent node and collapses

Author Message

Chris Glubish

Tuesday 24 August 2004 8:44:05 am

I have a simple list of objects. (some folders, some articles). When one is clicked, it opens down IF its a folder, or if its an article, just goes to the article. This works fine on the first level, but the minute I click down into a sublevel (folder or article) the list collapses. Essentially its a tree menu, but I have kept it sort of clunky on purpose. Is this easy to fix or do I have to redo the entire logic. Here is my code. (node 83 is the hard coded parent node for the top level of the folder)


{* Loop through all sub-folders/articles within the folder. *}
{section loop=fetch( content,
                     list,
                     hash( parent_node_id,     83,
                           class_filter_type,  include,
                           class_filter_array, array( 'article' ,'folder'),
                           sort_by,            $item.sort_array ) ) }

{* Display the folder-name or article as a link to a full view of the node if it is NOT the node we are on. If we are on the current node, just show plain unclickable text.*}
{section show=or( $:item.node_id|eq($node.node_id ))}
        {$:item.name}
{section-else}
       <a href={concat( "/content/view/full/", $:item.node_id, "/" )|ezurl}>
           {$:item.name}
       </a>
{* End of if-section. *}
{/section}

    <br />


{* Check if this node(folder) is the one that was accessed: *}
{section show=or( $:item.node_id|eq($node.node_id ))}

    {* Loop through all the nodes within this folder. *}
    {section loop=fetch( content,
                     list,
                     hash( parent_node_id,     $:item.node_id,
                           class_filter_type,  include,
                           class_filter_array, array( 'article' ),
                           sort_by,            $:item.sort_array ) ) }

    {* Display the name of each node as a link. *}
    <div style="margin-left: 8px;">
    <a href={concat( "/content/view/full/", $:item.node_id, "/" )|ezurl}>
        {$:item.name}
    </a>
    </div>

{* End of link-list loop. *}
{/section}

{* End of if-section. *}
{/section}


{* End of sub-folder loop. *}
{/section}