Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
I am implementing a folder and sub-folder structure and cannot get it to display. I would like it to display as follows:

MAIN FOLDER A (MFA)

    MFA SUB FOLDER 1
    MFA SUB FOLDER 2
    MFA SUB FOLDER 3

MAIN FOLDER B (MFB)

    MFB SUB FOLDER 1
    MFB SUB FOLDER 2
    MFB SUB FOLDER 3

i am using cms:folders with hierarchy and depth but it loops through the folder and returns


    MAIN FOLDER A (MFA)
    MFA SUB FOLDER 1
    MFA SUB FOLDER 2
    MFA SUB FOLDER 3
    MAIN FOLDER B (MFB)
    MFB SUB FOLDER 1
    MFB SUB FOLDER 2
    MFB SUB FOLDER 3

How can i split my code so that the MAIN FOLDER is the title and the Sub folders in the main folder are the list.
Hi,

There can be several ways of doing this but, I think, you'll find the following method the easiest -
Code: Select all
<cms:folders depth='1'>

    <h2><cms:show k_folder_title />  </h2>
   
    <cms:folders depth='1' childof=k_folder_name >
        <cms:show k_folder_title /><br />
    </cms:folders>
   
</cms:folders>

In the code above we use the cms:folders tag twice. First to make it list only the top level folders and then as the top-level folders are listed we use cms:folders again to list their child folders.

This will result in exactly the kind of listing you want.

Hope it helps.
Thank you so much KK. That was perfect. You make it look so easy.
3 posts Page 1 of 1