Forum for discussing general topics related to Couch.
12 posts Page 1 of 2
Hello All,

I have tried to search on here if anyone has asked this question but I could not get a feedback returned. I want to know if it is possible for one to click a parent folder and link to the child folders before linking to the page nested.

If possible how is that done.

Thank you.

Illustration

Parentfolder (FolderView)
---ChildFolder (FolderView)(sub)
------ChildChildFolder(folderview)(sub)
---------Page(pageview)
Please see the docs on folders at http://docs.couchcms.com/concepts/using-folders.html.
Specifically, find the sections discussing <cms:parentfolders> and <cms:breadcrumbs>.

Hope it helps.
I have used the parentfolder tag, it's not enumerating the subfolders.

That's why I'm seeking help. May be I'm doing something wrongly. I'll post the code as soon as I get on to my PC.

Thanks KK
What I intended to achieve is to list parent folders on the home page. Then the parent folder links should direct one to the subfolders, say on a product template section, which then links to the pages within.

Am I too ambitious?
I think I am unable to fully understand your use-case.
Suppose the folder structure is as follows -
Code: Select all
grandparent-1
    parent-1
        child-page-1
        child-page-2
    parent-2
        child-page-3
        child-page-4
grandparent-2
    parent-3
        child-page-5
        child-page-6
    parent-4
        child-page-7
        child-page-8

Is it that the homepage shows only grandparent-1, grandparent-2 where clicking grandparent-2 shows only parent-3, parent-4 and clicking parent-3 finally lists the two pages child-page-5, child-page-6 ?

If not, please use the tree structure above to show exactly what you wish.
Post some mockups if possible.

Thanks.
What you described up here is exactly what want to achieve.
To be more elaborate

Grand parents are listed on homepage thus:

Homepage (say if k_is_home)
GR1(Folder) - links to parent1 and 2 on say product.php template.
GR2(Folder) - links to 3 and 4

Product Template (say if k_is_list)
Parent1(folder) - links to child1(page) and child2(page)
Parent2 - links to child 3 and 4.

This sort of hierarchy is what is desired.

Thank you.
I'll give you some sample code that you should be able to tweak to suit your use-case.
Code: Select all
<cms:if k_is_home || k_is_folder> 
    <cms:folders masterpage='products.php' hierarchical='1' depth='1' childof=k_folder_name>
        <a href="<cms:show k_folder_link />"><cms:show k_folder_name /></a><br>
       
        <!-- if folder has pages and has no sub-folders -->
        <cms:if k_folder_pagecount && k_folder_immediate_children='0'>
            <h3>Pages:</h3>
            <cms:pages masterpage='products.php' folder=k_folder_name >
                <a href="<cms:show k_page_link />"><cms:show k_page_name /></a><br>
            </cms:pages>
        </cms:if>
    </cms:folders>
</cms:if>

The key above is the use of hierarchical='1' depth='1' childof=k_folder_name with cms:folders.
A depth of 1 will only fetch the immediate child folders of the folder used with the 'childof' parameter.

Hope it helps.
Thanks KK, I'll try as soon as I get on my PC.

I appreciate.
Thank you KK,

The first level transition from folders to child folders worked. However, the instruction code to enumerate folders when there are no child folders did not work.

Also for the child folders enumerated, child pages it contained were also not listed. I tried a number of tweaks to see I can get lucky, but I wasn't successful.

I'll attempt to put the code here shortly.

Thank you.
12 posts Page 1 of 2

Who is online

In total there are 4 users online :: 0 registered, 0 hidden and 4 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 4 guests

cron