Entry Count for Categories/Subcategories?

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
Vanessa
Posts: 9
Joined: Mon Apr 18, 2005 4:54 am

Entry Count for Categories/Subcategories?

Post by Vanessa » Wed Jun 08, 2005 5:26 am

Hi,

When you click on a top-level category that doesn't have a question, it says "No entries available" - some people might think that this means there are no entries available in the sub-categories as well, and won't bother to check them.

Is it possible to add some code that lists the sub-categories and the number of entries available in them?

I'm currently using v1.4.8 but can upgrade to a RC4 1.5.

Thanks! Love the software!

ETA: I've installed a test version of RC4 1.5 but I wanted to move the "Newest Questions" and "Ten Most Viewed" to the main template rather than the index. It was easy enough to do in v1.4.x but not so much now that the templates have been written... could someone help me out with that as well?

Thorsten
Posts: 14913
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten » Thu Jun 09, 2005 11:58 am

Hi,

you're right, the number of entries in the categories is a good idea.

About the newest questions and the TopTen:
This will be changed in 1.5.1, I've got a great patch for this problem.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

Vanessa
Posts: 9
Joined: Mon Apr 18, 2005 4:54 am

Post by Vanessa » Tue Jun 14, 2005 6:00 am

Thanks Thorsten. :)
Thorsten wrote:About the newest questions and the TopTen:
This will be changed in 1.5.1, I've got a great patch for this problem.
If anyone else is impatient for a quick 'n dirty patch for this now, I found that inserting:

Code: Select all

"writeTopTenHeader" => $PMF_LANG["msgTopTen"],
"writeTopTenRow" => generateTopTen(),
"writeNewestHeader" => $PMF_LANG["msgLatestArticles"],
"writeNewestRow" => generateFiveNewest()
));
to Line 25 of main.php fixed the problem for me. Then I added

Code: Select all

                
	<div class="content">
	<div id="latest">
	<h3>{writeNewestHeader}</h3>
	{writeNewestRow}
	</div>
	</div>
and

Code: Select all

               
<div class="content">
<div id="topten">
<h3>{writeTopTenHeader}</h3>
{writeTopTenRow}
</div>
</div>
to wherever I wanted "Newest Header" and "TopTenHeader" to appear in main.tpl

Hope that you'll consider adding the number of entries in the sub-category feature to later versions of the software!

Gastongr
Posts: 13
Joined: Mon Jul 19, 2004 12:32 am

Post by Gastongr » Thu Sep 08, 2005 6:05 am

Mhmm, what do you exactly mean by "inserting to Line 25 "

In line 25 i have

Code: Select all

 $tpl->includeTemplate('writeContent', 'index');
Should i replace that with what you posted?. I have tryed many ways but can't get it working, i'm doing something wrong.
Thanks for your help :wink:

Gastongr
Posts: 13
Joined: Mon Jul 19, 2004 12:32 am

Post by Gastongr » Mon Sep 12, 2005 1:11 pm

Anybody?
Please help, i don't fully understand Vanessa's explanation :oops:
Gaston

Thorsten
Posts: 14913
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten » Mon Sep 12, 2005 1:13 pm

Hi,

main.php has to look like this:

Code: Select all

<?php
/**
* $Id: main.php,v 1.2.2.2 2005/08/24 13:36:27 thorstenr Exp $
*
* @author       Thorsten Rinne <thorsten@phpmyfaq.de>
* @since        2002-08-23
* @copyright    (c) 2001-2005 phpMyFAQ Team
* 
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the 'License'); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* 
* Software distributed under the License is distributed on an 'AS IS'
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*/

$tpl->processTemplate ('writeContent', array(
                        'writeTopTenHeader' => $PMF_LANG['msgTopTen'],
                        'writeTopTenRow' => generateTopTen($LANGCODE),
                        'writeNewestHeader' => $PMF_LANG['msgLatestArticles'],
                        'writeNewestRow' => generateFiveNewest($LANGCODE),
                       'writeNewsHeader' => $PMF_CONF['title'].$PMF_LANG['msgNews'],
                       'writeNews' => generateNews($LANGCODE),
                       'writeNumberOfArticles' => $PMF_LANG['msgHomeThereAre'].generateNumberOfArticles().$PMF_LANG['msgHomeArticlesOnline']));

$tpl->includeTemplate('writeContent', 'index');
?>
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

Gastongr
Posts: 13
Joined: Mon Jul 19, 2004 12:32 am

Post by Gastongr » Mon Sep 12, 2005 1:18 pm

Thanks so much, i got it working :)

Alberto
Posts: 4
Joined: Thu Sep 29, 2005 2:52 pm
Contact:

Post by Alberto » Thu Sep 29, 2005 2:56 pm

Hi,

About the top-level category that doesn't have a question and says "No entries available", still no code/patch available?

Best Regards

Thorsten
Posts: 14913
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten » Thu Sep 29, 2005 3:18 pm

Hi Alberto,

what patch do you want to see with a top-level category with no entries?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

Alberto
Posts: 4
Joined: Thu Sep 29, 2005 2:52 pm
Contact:

Re: Entry Count for Categories/Subcategories?

Post by Alberto » Thu Sep 29, 2005 3:42 pm

I hope i'm talking about the same thing and that my english isn't so bad :roll:
Vanessa wrote: ...

Is it possible to add some code that lists the sub-categories and the number of entries available in them?

...
Thorsten wrote: ...

you're right, the number of entries in the categories is a good idea.

...
so instead to display "no entries" on the top-level category it will display
the sub-category with the number of entries.

btw, great program!

Best Regards

jazcyk
Posts: 385
Joined: Wed Sep 07, 2005 1:32 pm

workaround for "no entries"

Post by jazcyk » Fri Sep 30, 2005 5:15 am


Vanessa
Posts: 9
Joined: Mon Apr 18, 2005 4:54 am

Post by Vanessa » Wed Jan 25, 2006 1:45 am

Hi jazcyk,

Can I ask how you got it like that - did you have to hard code the link to the categories, or can you change the php code?

Thanks for any help.

Thorsten
Posts: 14913
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten » Wed Jan 25, 2006 6:51 am

Hi Vanessa,

we introduced this in 1.5.5.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

jazcyk
Posts: 385
Joined: Wed Sep 07, 2005 1:32 pm

just update ...

Post by jazcyk » Wed Jan 25, 2006 9:18 am

@vanessa

what I did with 1.5.0-1.5.4 was simply to add one single article to each empty catetory. The article had a header but no body!

But I just deleted these 'dummy' entries since the FAQ system itself now handles it OK.

Vanessa
Posts: 9
Joined: Mon Apr 18, 2005 4:54 am

Post by Vanessa » Thu Feb 09, 2006 3:12 am

Thanks Thorsten and jazcyk - I'm still using an old version, will try and implement your solution jazcyk. :)

Post Reply