Topic: Frequently Asked Questions (FAQ) Plugin

F.A.Q. Plugin
Click Here To Download From Extend
View GitHub Repos

This is a simple and easy to use F.A.Q. manager.

Features:

  • Create, edit & delete categories

  • Create, edit & delete questions for categories

  • Include faq categories within pages

  • Place the faq in your template files

Installation:

  • Drag the faq.php file to your plugins directory and navigate to 'pages->F.A.Q. Manager' in your Admin Panel.

  • There is a help page within the admin panel to explain how to include the faqs in your template or pages.


Screenshots:

View All Questions & Categories

http://michaelhenken.com/external/faq/viewall.jpg


Add New Question:

http://michaelhenken.com/external/faq/addnewquestion.jpg


Manage Categories:

http://michaelhenken.com/external/faq/categories.jpg


Add New Categories:

http://michaelhenken.com/external/faq/addcagory.jpg


Help:

http://michaelhenken.com/external/faq/help.jpg


Any suggestions to improve usability/functionality are appreciated.

Re: Frequently Asked Questions (FAQ) Plugin

Great looking plugin!

   I just installed but get an error message on every page,

Notice: Undefined offset: 0 in /home/content/26/8289626/html/get_simple/plugins/faq.php on line 511

Notice: Undefined offset: 0 in /home/content/26/8289626/html/get_simple/plugins/faq.php on line 516

This is a fresh install of GS. Any tips?

-J

Re: Frequently Asked Questions (FAQ) Plugin

verbunk wrote:

Great looking plugin!

   I just installed but get an error message on every page,

Notice: Undefined offset: 0 in /home/content/26/8289626/html/get_simple/plugins/faq.php on line 511

Notice: Undefined offset: 0 in /home/content/26/8289626/html/get_simple/plugins/faq.php on line 516

This is a fresh install of GS. Any tips?

-J

Re-install the plugin, it has been fixed in version 1.1.
Sorry about that, I forgot to check if a variable isset.

Re: Frequently Asked Questions (FAQ) Plugin

Hey. I just installed this and get this error:

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'i18n_base_admin_pre_header' not found or invalid function name in /customers/8/5/b/englishaliveacademy.org/httpd.www/GetSimple_3.0/GetSimple_3.1B_r610/admin/inc/plugin_functions.php on line 223

When I try to put a FAQ into the source cod, it puts it in comment blocks.

Im using your Random Generator though and it works great. Thanks a bunch for that.

Ben

Re: Frequently Asked Questions (FAQ) Plugin

zenn57 wrote:

Hey. I just installed this and get this error:

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'i18n_base_admin_pre_header' not found or invalid function name in /customers/8/5/b/englishaliveacademy.org/httpd.www/GetSimple_3.0/GetSimple_3.1B_r610/admin/inc/plugin_functions.php on line 223

This is an error in the I18N plugin, which I have not tested so far with 3.1 beta.
Try the new version 2.5.2.

I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.

Re: Frequently Asked Questions (FAQ) Plugin

cool plugin, however it generates error in p01-contact

" Notice: Trying to get property of non-object in *****************************/plugins/p01-contact_gs.php on line 69 "

using 3.0 version

Re: Frequently Asked Questions (FAQ) Plugin

Jimmy,

the notice you posted originates in the p01 Plugin, not the FAQ plugin.

Re: Frequently Asked Questions (FAQ) Plugin

I know, but the contact plugin works OK without the FAQ plugin. That's why I posted it here.
I will ask in the contact plugin thread

Re: Frequently Asked Questions (FAQ) Plugin

Hey thanks for the plugin. it works grat. I am just wondering if it is possible to setup FAQ page as a top level page (one of the pages) with all the categories and q&A?

Basically I want a complete FAQ page which even has a menu item in nav.

Re: Frequently Asked Questions (FAQ) Plugin

There is already another plugin called faq that uses faq.php.
You might want to prefix uour file to make it unique, caused me great confusion installing it.
heh

Re: Frequently Asked Questions (FAQ) Plugin

Tried to do this:

To show a category of FAQ from within a page use the following coding:
This will show posts on your page from the category you specify

{$ Your Category Name $}

However, not working for me.  The tag disappears from displaying on the page output, but never shows the FAQ category name and its content.

Using Innovation Theme (no modifications) and install base of 3.1B - Beta

Re: Frequently Asked Questions (FAQ) Plugin

shawn_a wrote:

There is already another plugin called faq that uses faq.php.
You might want to prefix uour file to make it unique, caused me great confusion installing it.
heh

Sorry about that. I was not aware. I will fix it in the next version.

Re: Frequently Asked Questions (FAQ) Plugin

can not delete questions, nor categories. clickin the "X" seems to be successfull, but after page refresh or revisit the deleted question/category is still showing up. any ideas? thx!

Re: Frequently Asked Questions (FAQ) Plugin

Yes, there's a failure when deleting entries. Nothing will be deleted but the message appears that the item is deleted.
Would you fix that please?

15

Re: Frequently Asked Questions (FAQ) Plugin

Hi,

Since I needed this plugin in my language, I added i18n functions and files,
and corrected the "delete question" problem.

You can find it here : GitHub
just click the "Downloads" link and select "download as zip" or Download as tar.gz"
You'll get a new faq.php, and a folder with 2 languages files (en_US and fr_FR)


Else, to correct the "delete question problem" only,
you can modify the faq.php file, remplacing lines 113-118

else
{
$child = $c_child->addChild('content');
$child->addAttribute('title', $atts['title']);
$child->addCData($content);
}

by

else
{
    if($delete_faq != null && $_GET['category_of_deleted'] ==  $c_atts['name'] && $_GET['delete'] == $atts['title'])
    {
        //Do nothing. Do not add it to new xml file
    }
    else {
        $child = $c_child->addChild('content');
        $child->addAttribute('title', $atts['title']);
        $child->addCData($content);
    }
}

AND

add at line 460, before

elseif(isset($_GET['faq_help']))
elseif(isset($_GET['delete']) && isset($_GET['category_of_deleted']))
{
    $FAQ->processFAQData(null,null,null,$_GET['delete']);
}

Re: Frequently Asked Questions (FAQ) Plugin

A very, very special thanks! You helped me out.
Next is: how I show questions first as anchor links and then each question with answer? :X

17 (edited by Wos 2012-04-29 02:36:53)

Re: Frequently Asked Questions (FAQ) Plugin

wirehack7 wrote:

A very, very special thanks! You helped me out.
Next is: how I show questions first as anchor links and then each question with answer? :X

Hi,

You can change the getFAQData function in faq.php with this one :
or add it with another name, read post 19
(NB. I added <span class="faqC">, </span> and other class="faqQ"  class="faqA" for use in CSS, you can erase them in the function)

function getFAQData($display_category=null,$display_faq=null)
{
    $data_file = getXML(FAQFile);
    $end_result = '';
    foreach($data_file->category as $category)
    {
        $c_atts= $category->attributes();
        if($display_category == null)
        {
            $end_result .= '<ul><li><span class="faqC">'.$c_atts['name'].'</span><ul>';
            
            foreach($category->content as $content)
            {
                $atts = $content->attributes();
                $end_result .= '<li><a class="faqQ" href="?id=faq&display_category='.urlencode($c_atts['name']).'&display_faq='.urlencode($atts['title']).'">'.$atts['title'].'</a></li>';
            }
            $end_result .= '</ul></li></ul>';
        }
        elseif($display_category == $c_atts['name'])
        {
            $end_result .= '<ul><li><span class="faqC">'.$c_atts['name'].'</span><ul>';
            foreach($category->content as $content)
            {
                $atts = $content->attributes();
                if($display_faq == null)
                {
                    $end_result .= '<li><a class="faqQ" href="?id=faq&display_category='.urlencode($c_atts['name']).'&display_faq='.urlencode($atts['title']).'">'.$atts['title'].'</a></li>';
                }
                elseif($display_faq == $atts['title'])
                {
                    $end_result .= '<li class="faqQ">'.$atts['title'].'<ul><li class="faqA">'.$content.'</li></ul></li>';
                }
            }
            $end_result .= '</ul></li></ul>';
        }
    }
    return $end_result;
}

You need to modify getFAQ too for :
or add it with another name, read post 19

function getFAQ($display_category=null,$display_faq=null)
{
    echo getFAQData($display_category,$display_faq);
}

and you can test it in a template with :

<style>
.faqC { color:magenta; }
.faqQ { color:purple; }
.faqA { color:grey; }
</style>
    <div class="wrapper clearfix">
        <!-- page content -->
        <article>
            <section>
                
                <!-- title and content -->
                <?php 
                    if ($_GET && isset($_GET["display_category"]))
                    {
                        if (isset($_GET["display_faq"]))
                        {
                            getFAQ($_GET["display_category"], $_GET["display_faq"]);
                        }
                        else
                        {
                            getFAQ($_GET["display_category"]);
                        }
                    }
                    else {
                        getFAQ(); /* all categories and Q/A */ ?> <hr />
                        <?php getFAQ("Catégorie de test"); /* the category "Catégorie de test" */ ?> <hr />
                        <?php getFAQ('Tests v2', null); /* the category "Tests v2" same as above */ ?> <hr />
                        <?php getFAQ('Tests v2', 'test 02'); /* the category "Tests v2", question "test 02" */ ?>
                <?php 
                    }
                 ?>
            </section>        
        </article>

It was for testing the different results, in real you would prefer in your template :
again, use it with another name, read post 19
(and if you keep the css part, it' better in the theme .css)

<?php 
if ($_GET && isset($_GET["display_category"]))
{
    if (isset($_GET["display_faq"]))
    {
        getFAQ($_GET["display_category"], $_GET["display_faq"]);
    }
    else
    {
        getFAQ($_GET["display_category"]);
    }
}
else {
    // put here your default display fonction, i.e. 
    getFAQ();
}
?>

Re: Frequently Asked Questions (FAQ) Plugin

Version 1.2 Has Been Uploaded To Extend
It contains the internationalization and "Delete Question" fix provided by Wos

Thank you for your contributions Wos.

19

Re: Frequently Asked Questions (FAQ) Plugin

@Mike First, big thanks you for your plugins.

@wirehack7 about the link tweak, instead of replacing the former functions, it would be better to simply add them with different names, i.e. :

function getFAQDataLink($display_category=null,$display_faq=null)
{
...
}
function getFAQLink($display_category=null,$display_faq=null)
{
    echo getFAQDataLink($display_category,$display_faq);
}

This way you keep all the functionalities.
And for the template, more options :

getFAQ(); // all categories
getFAQ("Catégorie de test"); // this category
getFAQLink(); // all categories as links
getFAQLink("Catégorie de test"); // this category as link
getFAQLink("Category 1", "Question 1"); // this answer

The "in real, useful template part" :

<section>
<!-- title and content -->
<?php 
    if ($_GET && isset($_GET["display_category"]))
    {
        if (isset($_GET["display_faq"]))
        {
            getFAQLink($_GET["display_category"], $_GET["display_faq"]);
        }
        else
        {
            getFAQLink($_GET["display_category"]);
        }
    }
    else {
        getFAQLink(); /* all categories and Q/A */ 
    }
 ?>
</section>