Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
I have tried a number of thing but just can't this is work. I'm sure its simple.

I have a simple clonable template with dynamic folders. The template is for an FAQ section. The default title is used for the question and an additional textarea field is set up for the answer. Each individual FAQ is sorted into a folder.

I want to be able to output a listing of all FAQs and their titles (folders) eg

Folder name 1
faq 1
faq 2

Folder name 2
faq 3
faq 4

I am not using page view or folder view, just the listing view. I can't get it so that the folder name is only outputted once with each of the FAQs under it.

Any help would be appreciated. Thanks.
The key to this is using both the 'folders' tag and 'pages' tag. I imagine you were just using the 'pages' tag.

Lets say we just wanted to list the folders, we could accomplish this as so:
Code: Select all
<cms:folders>
<h3><cms:show k_folder_title /></h3>
</cms:folders>
Folder Title 1
Folder Title 2

The next step to output each FAQ Question/Answer under it's folder is to make use of the 'pages' tag. We are also using the 'folder' parameter to ensure that only the FAQ Q&A's for the appropriate folder are listed:
Code: Select all
<cms:folders>
<h3><cms:show k_folder_title /></h3>
<cms:pages folder=k_folder_name>
<p><strong><cms:show k_page_title /></strong><br>
<cms:show faq_answer /></p>
</cms:pages>
</cms:folders>
Folder Title 1
FAQ 1 Question
FAQ 1 Answer
FAQ 2 Question
FAQ 2 Answer

Folder Title 2
FAQ 3 Question
FAQ 3 Answer
FAQ 4 Question
FAQ 4 Answer

I haven't tested this, nevertheless I have used a similar method in the past so I think this should work just fine.
Works perfectly. Thank you so much.
I knew it was a combination of a few tags but just couldn't crack it.
3 posts Page 1 of 1