having a message no faq in a folder

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
francois
Posts: 5
Joined: Mon Aug 14, 2006 1:31 pm

having a message no faq in a folder

Post by francois »

When there is no article in a category there is the category title with a link, if there is faq in this category you have all the list.

-> Is it possible to have a message like this "No faq here" when there is no faq and no category in a category? And how can I do that?


I try to make this modification alone but i didn't found how to do.

Thanks a lot for your answers :)
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Post by matteo »

Hi,
locate, backup and open the file [PATH_TO_PMFINSTALL]/show.php and replace the code:

Code: Select all

    $records = printThemes($category);
    if (!$records) {
        $cats = new Category($LANGCODE);
        $cats->transform($category);
        $cats->collapseAll();
        $records = $cats->viewTree();
    }
with:

Code: Select all

    $records = printThemes($category);
    if (!$records) {
        $cats = new Category($LANGCODE);
        $cats->transform($category);
        $cats->collapseAll();
        $records = '<div id="nofaq">No faq here.</div>';
    }
That's all ;).

Regards,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
francois
Posts: 5
Joined: Mon Aug 14, 2006 1:31 pm

Post by francois »

Hello,

thanks a lot for your quick answer.

I have already try to change this part of code but there is a small problem when i have different level of category.

This is how is my faq :

Home
-Level 1
--Level 2
---level 3
----FAQ 1
----FAQ 2
----FAQ 3

Etc...

If I made this type of change, when i am under the level 2 page I have the "no faq" message and i don't have any links for accessing to the Level 3 because it is not displaying the list of subcategory available.

I would like to know how we can display this message if there is no faq and no subcategory only ?

I don't know if my explaination is super clear :)
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Post by matteo »

Hi,
I've missed the constraint 'no category' ;).
Find below a new proposal:

Code: Select all

    $records = printThemes($category);
    if (!$records) {
        $cats = new Category($LANGCODE);
        $cats->transform($category);
        $cats->collapseAll();
        if (count($cats->getChildren($category)) > 0) {
            $records = $cats->viewTree();
        } else {
            $records = '<div id="nofaq">No faq here.</div>';
        }
    }
This code above doesn't cover the scenario in which you have subcategories but no one of them contains any faq.

Regards,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
francois
Posts: 5
Joined: Mon Aug 14, 2006 1:31 pm

Post by francois »

Awesome it works.

thanks a lot for your help :)
Post Reply