Last updated February 29, 2012. Created by xenophyle on July 11, 2011.
Edited by wmostrey, cgroche. Log in to edit this page.
Here is a recipe for creating a FAQ using nodes and Views. I did this in Drupal 7 but it should work in D6 also, although some steps will be different due to the new D7 user interface.
I am using the Administration Menu module with the Administration menu Toolbar style submodule enabled, and my directions to navigate to pages reflect that.
You will need the Token module installed.
Step 1: Create the FAQ content type

- Go to Structure -> Content types -> Add content type.
- Give the content type the name "FAQ".
- Change the title field label to "Question"
- I recommend unchecking "Promoted to front page" and "Display author and date information" and disabling comments.
- Save the content type and go to "Manage fields"
- Delete the body field.
- Add a new field called "Answer" of type long text (i.e., an html textarea)
- Here are the settings I used for the Answer field:
- Check required field
- 20 Rows
- Text processing: Filtered text
- Number of values: 1
- If you want to be able to control exactly what order the FAQs are shown in, you could also add an integer field called "Sort order".
Step 2: Create some FAQ nodes

- Go to Content -> Add content -> FAQ.
- Fill in the question and answer fields and save.
Step 3: Create Views

Now we will create two views (actually two displays in one view): one for the table of contents and one for the full-body list of the FAQs. One display will be a page and the other can be an attachment or a block. I found using a block makes it easier to apply the desired CSS, since using an attachment marks up the page as one view inside another.
Initial view configuration
Here is where there is a difference between D6 and D7. In Drupal 7 I needed to make the table of contents the block view and make the full-body faq list the page view, since the block is rendered above the page display. I believe (but haven't confirmed) in D6 you would do the reverse: the table of contents would be the page view.
- Go to Views-> Add new view
- On the configuration page that takes you to:
- Call the view "FAQ".
- Show content of type FAQ sorted by (your desired sort order)
- Create a page
- Page title: Frequently asked questions
- Path: faq
- Display format: HTML list of fields
- Items to display: (leave blank)
- Create a menu link (if desired) in the desired menu (probably Main) with Link text: FAQ
- Create a block
- Block title: (Title of your choice)
- Formatted list of titles
- Items per page: (leave blank)
- Continue and edit
Table of contents display configuration
This will create a list of the questions that link to the full FAQ node farther down on the page.
In the "Fields" section
- Add field: Global: View result counter
- Check "Exclude from display"
- Starting value: 1
- Edit field: Title
- Uncheck "Create a label"
- Under "Rewrite results", check "Output this field as a link" and set link path as faq#[counter]
In Drupal 6 the result counter field will need to come before the title.
Full-body display
In the "Fields" section
- Add field: Global: View result counter
- Check "Exclude from display"
- Starting value: 1
- Edit field (or create if not there): Title
- Uncheck "Create a label"
- Under "Rewrite results", check "Rewrite the output of this field" and set Text to <a name="[counter]">[title]</a>
- Add field: Content: Answer
- Uncheck "Create a label"
- (Optional: link back to top of page) Add field: Global: custom text
- Uncheck "Create a label"
- Set Text to <a href="faq#main-content">Back to Top</a>
Step 4: Configure block
- Go to Structure->Blocks
- Find your new block and move it into the Content section (assuming your theme has a region called "content")
- Show the block only on the lists pages: faq
- Save block
Comments
How do I....
I have set this up and it works great, thank you!
There's one thing I'd like to know if possible:
Currently when you click on the links in the block it takes you to the content without refreshing the page - and works perfectly as long as you only click on the links in the block. But when you click on "Back to Top" the page refreshes - now you can click on any "Back to Top link without a page refresh, but when you click on a link in the block the page will refresh again... So site visitors are forced to refresh the page each time they alternate between a click on a content link and "Back to Top".
Is there a setting that would allow navigation without refreshing the page?
Thanks again!
A tip!
First, thanks for this description, it works great!
I did a minor tweak though: If you want the title of each faq-item to list to the original faq content page, add the field Content: Path to your fields list on the full-body display. Make sure it's placed above the Content: Title field (if not, rearrange! The replacement patterns only "read" the above listed fields...).
Then tweak the rewrite text under Step 3, Full-body display, point 6 to :
<a name="[counter]" href="[path]">[title]</a>Simple as that :)
Not a necessary change, but thought I'd share it anyway, in case someone wanted to do the same for any reason.
Unable to get this to work
In views if I add a field, in either the block or the page sections, I automatically get the same field and settings the other section. The result is that I get the answer at the top of the page next to the link. I've been over and over it but don't know how to avoid this.