Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Frequently Asked Questions (FAQ) Plugin
#1
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

[Image: viewall.jpg]


Add New Question:

[Image: addnewquestion.jpg]


Manage Categories:

[Image: categories.jpg]


Add New Categories:

[Image: addcagory.jpg]


Help:

[Image: help.jpg]


Any suggestions to improve usability/functionality are appreciated.
Reply
#2
Great looking plugin!

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

Code:
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
Reply
#3
verbunk Wrote:Great looking plugin!

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

Code:
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.
Reply
#4
Hey. I just installed this and get this error:
Quote: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
Reply
#5
zenn57 Wrote:Hey. I just installed this and get this error:
Quote: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.
Reply
#6
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
Reply
#7
Jimmy,

the notice you posted originates in the p01 Plugin, not the FAQ plugin.
Reply
#8
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
Reply
#9
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.
Reply
#10
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
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#11
Tried to do this:
Quote: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
Reply
#12
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.
Reply
#13
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!
Reply
#14
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?
Reply
#15
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
Code:
else
{
$child = $c_child->addChild('content');
$child->addAttribute('title', $atts['title']);
$child->addCData($content);
}

by

Code:
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
Code:
elseif(isset($_GET['faq_help']))

Code:
elseif(isset($_GET['delete']) && isset($_GET['category_of_deleted']))
{
    $FAQ->processFAQData(null,null,null,$_GET['delete']);
}
Reply
#16
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
Reply
#17
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)

Code:
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
Code:
function getFAQ($display_category=null,$display_faq=null)
{
    echo getFAQData($display_category,$display_faq);
}

and you can test it in a template with :
Code:
<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)
Code:
<?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();
}
?>
Reply
#18
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.
Reply
#19
@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. :
Code:
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 :
Code:
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" :
Code:
<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>
Reply
#20
(2012-02-21, 13:44:34)bandrzej Wrote: 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.

I'm having the same problem here, cannot for the life of me get anything to display. The backend works perfectly but no matter how much I try, I can't get anything to display on any page using the snippet above.

I have a FAQ with the name 'How long until my parcel is delivered?' so I've used {$ How long until my parcel is delivered? $} but it doesn't work.

I did notice the following are blank - is this the reason why?

Code:
    /*********
    Front End Functions
    *********/
    public function viewFAQ()
    {
    
    }
    
    public function filterFAQ()
    {
    
    }

    public function viewCategories()
    {
    
    }
Reply
#21
**Bump** - anyone got any ideas why this isn't working?
Reply
#22
Can anyone help me out a bit ? I am using the MyCompany theme for my website.I created a new faq page , but find it a bit hard to figure out where exactly i should put the code to display the faq questions.

For this page i am using frontpage.php as a template , renamed it to frontpage2.php to allow me to use a different image on the faq page.

This is the code of frontpage2.php :

PHP Code:
<?php if(!defined('IN_GS')){ die('you cannot load this page directly.'); }
/****************************************************
*
* @File:             template.php
* @Package:        GetSimple
* @Action:        myCompany theme for GetSimple CMS
*
*****************************************************/

# Include the header template
include('header.inc.php'); ?>

    <div id="main-container">
        <div class="inmain">
    <div id="main" class="wrapper clearfix frontpage">
            
            <article>
        <header>
          <h1><?php get_page_title(); ?></h1>
                </header>
                <section>
                  <?php get_page_content(); ?>  
                </section>
            </article>
      <aside>
      <img src="<?php get_theme_url(); ?>/customize/flowers.png" alt="Notebook with screenshot" />
      </aside>
<!---            
            <aside>
                <h3>aside</h3>
                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sodales urna non odio egestas tempor. Nunc vel vehicula ante. Etiam bibendum iaculis libero, eget molestie nisl pharetra in. In semper consequat est, eu porta velit mollis nec. Curabitur posuere enim eget turpis feugiat tempor. Etiam ullamcorper lorem dapibus velit suscipit ultrices.</p>
            </aside>
-->             
        </div> <!-- #main -->
        </div>
    </div> <!-- #main-container -->

<?php 
# Include the footer template
include('footer.inc.php'); ?>

My website is located here : http://is.gd/gGfetD

What i would need is to know where the code should be put to have it displayed below the 2 columns and above the social likns icons.

So far it has not worked for me yet !

Anyone ?
Reply
#23
(2012-11-12, 20:22:08)thedoglett Wrote: **Bump** - anyone got any ideas why this isn't working?

In version 1.2, the callback function is this:

Code:
function faq_replace($content)  {
    $the_callback = preg_match('/(<p>\s*)?{\$\s*([a-zA-Z0-9_]+)(\s+[^\$]+)?\s*\$}(\s*<\/p>)?/', $content, $matches);
    if(isset($matches[0])) {
        $display_category = str_replace('{$ ', '', $matches[0]);
        $display_category = str_replace(' $}', '', $display_category);
        $display_category = str_replace('<p>', '', $display_category);
        $display_category = str_replace('</p>', '', $display_category);
        $faq = returnFAQ($display_category);
        echo str_replace($matches[0],$faq,$content);
    } else {
        return $content;
    }
}

Version 1.0 had a different set of functions for this:

Code:
function faq_replace($content) {
    return preg_replace_callback('/(<p>\s*)?{\$\s*([a-zA-Z0-9_]+)(\s+[^\$]+)?\s*\$}(\s*<\/p>)?/', 'faq_replace_match', $content);
}

function faq_replace_match($matches) {    
    $category = trim($matches[2].$matches[3]);
    getFAQ($category);
}


The bandaid solution is to replace the new code with the old code. I don't know enough to properly fix it, though.

Hope that helps.
Reply
#24
(2013-05-22, 07:31:06)benrusso Wrote:
(2012-11-12, 20:22:08)thedoglett Wrote: **Bump** - anyone got any ideas why this isn't working?

In version 1.2, the callback function is this:

Code:
function faq_replace($content)  {
    $the_callback = preg_match('/(<p>\s*)?{\$\s*([a-zA-Z0-9_]+)(\s+[^\$]+)?\s*\$}(\s*<\/p>)?/', $content, $matches);
    if(isset($matches[0])) {
        $display_category = str_replace('{$ ', '', $matches[0]);
        $display_category = str_replace(' $}', '', $display_category);
        $display_category = str_replace('<p>', '', $display_category);
        $display_category = str_replace('</p>', '', $display_category);
        $faq = returnFAQ($display_category);
        echo str_replace($matches[0],$faq,$content);
    } else {
        return $content;
    }
}

Version 1.0 had a different set of functions for this:

Code:
function faq_replace($content) {
    return preg_replace_callback('/(<p>\s*)?{\$\s*([a-zA-Z0-9_]+)(\s+[^\$]+)?\s*\$}(\s*<\/p>)?/', 'faq_replace_match', $content);
}

function faq_replace_match($matches) {    
    $category = trim($matches[2].$matches[3]);
    getFAQ($category);
}


The bandaid solution is to replace the new code with the old code. I don't know enough to properly fix it, though.

Hope that helps.

Hi !

Thanks for the effort though i already fixed it in a different way by adding more css to the relevant files and do some extra coding to enable a tool tip and thus creating a differet faq page.

Anyway , hope this topic may get someone else on its way , if they experience the same issue(s)
Reply
#25
Error display module:
http://gscms.ct8.pl/faq/
How to fix it?
Reply




Users browsing this thread: 1 Guest(s)