Please, post your complete template code (attached in a zip). I see that in page-view you, perhaps, did not delete the top-most tag-pair 'cms:pages' as instructed, that is why you got so many links in footer. I will rectify all issues in your template and will add a folder-view code.
This code allowed me to display dynamic footer links which reflect only the current folder's root folder, and child folders, on folders or pages cloned from a template, and not other root folders or children from the same template.
It's a mouthful, but it works.
- Code: Select all
<cms:if k_template_name eq 'industries.php'>
<cms:if k_is_page>
<cms:if k_page_folderparentid eq '-1'>
<!-- We are on page which is in a parent folder. Show folders from this root -->
<cms:folders masterpage=k_template_name hierarchical='1' root=k_page_foldername>
<cms:if k_level eq '0'>
<!-- show root folder as title and root folder link as resources -->
<p class="footer-label text-md-left text-xs-center"><cms:show k_folder_title /></p>
<p class="text-md-left text-xs-center"><a href="<cms:show k_folder_link />">Resources</a></p>
<cms:else />
<!-- list all children -->
<p class="text-md-left text-xs-center"><a href="<cms:show k_folder_link />"><cms:show k_folder_title /></a></p>
</cms:if>
</cms:folders>
<cms:else />
<!-- We are on page which is NOT in a parent folder and is in a child folder. Show folders starting from the ancestor -->
<!-- Find the ancestor of current folder -->
<cms:set my_ancestor_folder='' scope='global' />
<cms:parentfolders folder=k_page_foldername>
<cms:if k_folder_parentid eq '-1'>
<cms:set my_ancestor_folder=k _folder_name scope='global' />
</cms:if>
</cms:parentfolders>
<cms:folders masterpage=k_template_name hierarchical='1' root=my_ancestor_folder>
<cms:if k_level eq '0'>
<!-- show root folder as title and root folder link as resources -->
<p class="footer-label text-md-left text-xs-center"><cms:show k_folder_title /></p>
<p class="text-md-left text-xs-center"><a href="<cms:show k_folder_link />">Resources</a></p>
<cms:else />
<!-- list all children -->
<p class="text-md-left text-xs-center <cms:if k_page_folderid eq k_folder_id >active</cms:if>">
<a href="<cms:show k_folder_link />"><cms:show k_folder_title /></a></p>
</cms:if>
</cms:folders>
</cms:if>
<cms:else_if k_is_folder />
<cms:if k_folder_parentid eq '-1'>
<!-- We are in a parent folder. Show folders from this root -->
<cms:folders masterpage=k_template_name hierarchical='1' root=k_folder_name>
<cms:if k_level eq '0'>
<!-- show root folder as title and root folder link as resources -->
<p class="footer-label text-md-left text-xs-center"><cms:show k_folder_title /></p>
<p class="text-md-left text-xs-center"><a href="<cms:show k_folder_link />">→ Resources</a></p>
<cms:else />
<!-- list all children -->
<p class="text-md-left text-xs-center"><a href="<cms:show k_folder_link />"><cms:show k_folder_title /></a>
</p>
</cms:if>
</cms:folders>
<cms:else />
<!-- We are in a child folder. Show folders starting from the ancestor -->
<!-- Find the ancestor of current folder -->
<cms:set my_ancestor_folder='' scope='global' />
<cms:parentfolders folder=k_folder_name>
<cms:if k_folder_parentid eq '-1'>
<cms:set my_ancestor_folder=k _folder_name scope='global' />
</cms:if>
</cms:parentfolders>
<cms:set my_current_folder_id=k _folder_id scope='global' />
<cms:folders masterpage=k_template_name hierarchical='1' root=my_ancestor_folder>
<cms:if k_level eq '0'>
<!-- show root folder as title and root folder link as resources -->
<p class="footer-label text-md-left text-xs-center"><cms:show k_folder_title /></p>
<p class="text-md-left text-xs-center"><a href="<cms:show k_folder_link />">Resources</a></p>
<cms:else />
<!-- list all children -->
<p class="text-md-left text-xs-center"><a href="<cms:show k_folder_link />"><cms:if k_folder_id eq my_current_folder_id>→ </cms:if><cms:show k_folder_title /></a></p>
</cms:if>
</cms:folders>
</cms:if>
<cms:else_if k_is_list /> .....
</cms:if>
</cms:if>