In this board you can talk about general questions about phpMyFAQ
Moderator: Thorsten
francois
Posts: 5 Joined: Mon Aug 14, 2006 1:31 pm
Post
by francois » Mon Aug 14, 2006 1:38 pm
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 » Mon Aug 14, 2006 2:21 pm
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
francois
Posts: 5 Joined: Mon Aug 14, 2006 1:31 pm
Post
by francois » Mon Aug 14, 2006 3:10 pm
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 » Mon Aug 14, 2006 3:22 pm
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
francois
Posts: 5 Joined: Mon Aug 14, 2006 1:31 pm
Post
by francois » Mon Aug 14, 2006 3:38 pm
Awesome it works.
thanks a lot for your help