|
Cookbook /
PublishFAQSummary: Supplied with a raw list of Qs and As, it outputs a formatted FAQ complete with TOC
Version: 1.0rc - initial release
Prerequisites: PmWiki 2.1
Status: RC
Maintainer: Octocias
Categories: Layout
Questions answered by this recipe
DescriptionCreating and managing any compilation of data is a tedious task and a waste of time. FAQs are not exempt. This script takes a raw list of Qs and As, and it outputs a formatted FAQ list complete with a table of contents which automatically point to the Q & A pairs further down the page. Each Q&A also links back to the top for fluid navigation. Usage & FormatAll you need to insert a formatted FAQ is a page with the data and it's inclusion using the following format:
FAQ format:
followed by any number of pairs in the following format:
InstallingDownload oct-publishfaq.phpΔ and copy it to your cookbook folder. Install by adding to config.php:
About the div nameThe look you see in the demo page is achieved by the following code extracted from my skin's css:
div.faqtoc
{
border: 1px rgb(140, 172, 187) solid;
padding:0px;
background: rgb(249, 251, 255);
width: 100%;
visibility: visible;
}
FAQ Example page(s)To see it in action, visit Octocias' FAQDemo. Release Notes
CommentsI would very much like to use this recipe, but I cannot get it to work. I looked at the example and copied and pasted all the variations and combinations I could think of, but it still won't work.
This is the error message I get: This is the code I have on the edit page: Could you please include a little more detailed explanation of how this thing works and maybe verify that the script file is up-to-date and accurate (especially since your example is more updated than the script here)? ~Jennifer Humphrey Yup, broken here too. Marc, 8 June 06 Same here... broken for me... I tried applying the updates the author suggested at the bottom... still can't make it work. Anybody figure out how to make a working copy of this? Or, it looks like the author has an updated version on his/her site... any way to download that? Frank G. 10/4/2006
GmB-(September 26, 2006.) I had to create two pages to get it to work. Put all your questions and answers on one page, then on your main faq page put in the tag (:publishFAQ Main.FAQ:). Main.FAQ is just an example, type in your faq page. Then as long as all the questions and answers are on the page you are pointing to you should be fine. Oh don't forget to remove the <>. I've got a workaround for me that may help others. Basically, people want the page with the FAQ to be the same page as the data page. The author provides some code fixes below, but I couldn't get them to work. My workaround is to pass in the same pages name as the parameter. For example, let's say you have your FAQ page at Main.FAQ and you also want your data to reside on the same page. Put
(:if !true:) [Q-Title: Questions:] [A-Title: Answers:] [TOC-Style: faqtoc:]
Works well for me. Frank G. 10/4/2006 See AlsoContributors[Octocias] - Thanks to Kaleb Kajero & Nik Makepeace (no PmWiki profile) Small RevisionI didn't like it too much that it was necessary to define the name of a page where the FAQ should be displayed because very often this is the same as the data page itself. I revised the oct-publishfaq a little bit and now it is possible to either define a page or leave it blank in order to use the same.
Please note. This is rather quick and dirty. Therefore Changes made in oct-publishfaq.phpBefore: Markup('publishfaq', '<[[<<]]',
'/\\(:[p|P]ublish[f|F][A|a][Q|q] +(.+)\\s*:\\)/e', "PublishFAQ('$1')");
Now: Markup('publishfaq', '<[[<<]]',
'/\\(:[p|P]ublish[f|F][A|a][Q|q]+(.*)\\s*:\\)/e', "PublishFAQ('$1')");
PublishFAQ is now:
function PublishFAQ($PagePath = '')
{
if(empty($PagePath)){
$tmp = explode('/', $GLOBALS['GLOBALS']['_SERVER']['PATH_INFO']);
$PagePath = $tmp[1] . "." . $tmp[2];
}
...
User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |