Add Sections to your phpBB 2 FAQ

When you add new features to your phpBB 2 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 frequently asked questions page, or FAQ. phpBB comes with two default FAQs. These are the main FAQ 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. 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:

$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:

$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.

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.