Displaying the sub-folders

These documentation pages are no longer maintained. Please visit the new documentation site.

The {include uri="design:links_tree_menu.tpl"} line within the template code presented in the previous section instructs eZ publish to include a file called "links_tree_menu.tpl". The "design:" prefix specifically states that it should look inside the "templates" and the "override/templates" sub-folders of the current (tscm) design folder. Obviously, eZ publish will first try to include the "design/tscm/templates/links_tree_menu.tpl" file. Create this file and attempt to write a piece of template code that always loops through and displays the sub-folders of the "Links" folder. You'll need to acquire and specify the identification number of the "Links"-node. The folders should be displayed as links. A link should point to the full view of the node that contains the actual folder object. Feel free to peek at/use the following template code:

{* Loop through all sub-folders within the "Links" folder. *}

{section loop=fetch( content,

                    list,

                    hash( parent_node_id,    __NODE_ID_OF_LINKS__,

                          class_filter_type, include,

                          class_filter_array, array( 'folder' ),

                          sort_by,           $node.sort_array ) ) }

 

   {* Display the folder-name as a link to a full view of the node. *}

   <b>

      <a href={concat( "/content/view/full/", $:item.node_id, "/" )|ezurl}>

          {$:item.name}

      </a>

    </b>

   <br />

 

{* End of sub-folder loop. *}

{/section}

If you're using the code that was presented above, make sure that you replace the "__NODE_ID_OF_LINKS__" part with the identification number of the "Links"-folder node. Notice that we're using the fetch function directly inside a section (without doing a "let" first). Refresh the links page. At this point, you should be looking at a page that looks someting like this:

When you click on the name of the different folders, the template will display information about the folder that was accessed (on the right hand side). However, regardless of the folder that was accessed, the template will always display the entire list of sub-folders within the "Links" folder. This happens because we hardcoded the identification number of the "Links" node.

Comments

Contents

Building an eZ publish site

Prerequisits
Situation
Creating the TSCM site
Testing the interfaces
Setting up the main layout
Creating sections
The welcome page
The news page
The members page
The guestbook
The links page
    Adding content
    Creating the template
    Displaying the sub-folders
    Displaying the contents of a folder
    Creating a tree-style appearence
    Same content at different locations


Created

26/11/2003
5:51:29 pm
by Balazs Halasy

Last updated

26/11/2003
6:12:19 pm
by Balazs Halasy

Authors

Balazs Halasy



This page is part of the eZ Publish documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.