Talk martial arts at

Bookmark and Share

Add Sections to Forum FAQ

Add Sections to Forum FAQ

Postby Thoul » April 2nd 2004, 6:27 pm

When you add new features to your forum, it's always a good idea to explain how these work for your users. One way of doing this is to add a new section to your forum's FAQ. phpBB comes with two default FAQs. These are the main FAQ, like this one and a BBCode Guide linked in the posting form.

The text for these pages is stored in the language/lang_english/lang_faq.php and language/lang_english/lang_bbcode.php files, respectively. Each language on your forum may have it's own copy of these files, which are parsed by faq.php to create the list of question links at the top and the sections containing question and answer blocks on the FAQ pages displayed to users. If you want to add sections to the FAQ explaining how to use new BBCodes, you should edit lang_bbcode.php. Adding sections to the main FAQ requires editing lang_faq.php. Both files use a common format, which is explained later. Some large hacks may also come with their own FAQ pages stored in similar files.

There are two types of entries in each FAQ. These are header entries and question entries.

Each header entry creates a separate section on the FAQ page. Header entries look like this:
Code: Select all
$faq[] = array('--', "Text for Header");

The two dashes indicate that this is a header entry. All of the question entries following one header entry and preceding another or the end of the file will be displayed in the section created by the first header.

Question entries are very similar. They look like this:
Code: Select all
$faq[] = array("question", "answer");

Obviously, you would replace question and answer with the actual text of your FAQ question and answer.

When entering the text for your header, question, and answer, you must be careful about using double quote characters. Using double quotes inside one of these, as shown below, will create a parse error. If you need to use double quotes, add a backslash (\) before it. This is called escaping the double quote.
Code: Select all
This is wrong:
$faq[] = array("What can create a parse error?", "Using a " inside a header, question, or answer.");

This is right:
$faq[] = array("What can fix a parse error?", "Escaping the \" inside a header, question, or answer.");

Also make sure you include the closing parentheses and semi-colon for each entry. Leaving either of those off can also cause a parse error.
User avatar
Posts: 18551
Joined: July 30th 2002, 11:30 am
Location: USA

Return to phpBB 2: Customizing Your phpBB

Who is online

Users browsing this forum: No registered users and 0 guests