Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Category/Sub-category Article count doesn't look right  (Read 7878 times)

jlhaslip

  • Sr. Member
  • ****
  • Karma: 16
  • Posts: 374
    • My snews with AEF Forum site
Category/Sub-category Article count doesn't look right
« on: April 08, 2008, 12:28:03 PM »

Using the Default Template and added a couple of Sub-categories under a Category (of course),

So I have a few articles under a category, BUT, the article COUNT for the Category only reflects the single article which has been added directly to the category and doesn't include the total of the articles in the complete category???  I could have a hundred articles there, but the Client only sees one? I don't know if that is correct. It might be one of rhetorical questions, but should the Main category article count show the total of the Articles the Category includes ( add all the sub-category articles to the count?)

Don't know... thought i'd mention it in case this is errant behaviour...

Logged
Yes! I have no siggy.

Joost

  • Guest
Re: Category/Sub-category Article count doesn't look right
« Reply #1 on: April 08, 2008, 01:25:50 PM »

As I see it, it is intended. Others might see it work different.
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: Category/Sub-category Article count doesn't look right
« Reply #2 on: April 09, 2008, 01:03:40 AM »

Yes, a prickly one..
Personally, I turn the numbers off.
When I visit a site, it is on the assumption they have something.. anything... behind a link. I don't need to know that there is one, or 2 squillion ;) If the link name is explanatory, and I am interested in it, I'll go there.

The only thing I'd want the numbers for, is in admin, to see what areas of the site I have been neglecting (more than most)

Just my thoughts on the numbers game.
Logged
Of all the things I have lost, it is my mind that I miss the most.

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: Category/Sub-category Article count doesn't look right
« Reply #3 on: April 12, 2008, 05:35:18 AM »

further on this, if the top level category is empty, but subcategories have articles, should the link act as a menu open link, exposing the underlying subcategory links without altering the center content?
Logged
Of all the things I have lost, it is my mind that I miss the most.

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: Category/Sub-category Article count doesn't look right
« Reply #4 on: April 12, 2008, 01:50:40 PM »

further on this, if the top level category is empty, but subcategories have articles, should the link act as a menu open link, exposing the underlying subcategory links without altering the center content?

That's the way I would want it to work... click the category title to expand the sub-list showing both category content links & subcat titles... then click a subcat title to show its content links. I would want center content to change only when clicking a content link.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Joost

  • Guest
Re: Category/Sub-category Article count doesn't look right
« Reply #5 on: April 12, 2008, 02:58:15 PM »

further on this, if the top level category is empty, but subcategories have articles, should the link act as a menu open link, exposing the underlying subcategory links without altering the center content?

That's the way I would want it to work... click the category title to expand the sub-list showing both category content links & subcat titles... then click a subcat title to show its content links. I would want center content to change only when clicking a content link.

If you need that, you could use a slightly modified function archive or function sitemap.
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: Category/Sub-category Article count doesn't look right
« Reply #6 on: April 12, 2008, 05:24:31 PM »

further on this, if the top level category is empty, but subcategories have articles, should the link act as a menu open link, exposing the underlying subcategory links without altering the center content?

That's the way I would want it to work... click the category title to expand the sub-list showing both category content links & subcat titles... then click a subcat title to show its content links. I would want center content to change only when clicking a content link.

If you need that, you could use a slightly modified function archive or function sitemap.


Yes... I am using modified archive and sitemap functions to display all as desired on those pages.

I was referring to category/SubCategory menuing. I have achieved the desired actions (just this past week) in my most recent 1.6 MEMU with cats/subcats... and with articles & pages-in cats/subcats. My objective was to have category titles in a horizontal nav-bar. Clicking a category title expands a dropdown with the category's content links (articles and/or pages) and Subcategory titles. Clicking a Subcategory title now shows a flyout with its content links (articles and/or pages) as well. The categories/subcategories functions are using generic  <ul><li>  structure... so they will generate both vertical and horizontal text-link menus. The accompanying CSS can be easily re-styled for either, and to display with or without background imaging... and no javascript required.

My next objective is to have choices in the Settings panel where the Admin would choose to publish articles OR pages (one or the other) or both.... to Categories & SubCategories... using either checkboxes or radio buttons.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: Category/Sub-category Article count doesn't look right
« Reply #7 on: April 13, 2008, 09:14:49 AM »

Actually, why use the toggle in the categories anyway? Why aren't we doing it with css, and some sort of fly-out menu?

Can understand use in archives/sitemap in order to save page space, but why in a 'menu' ?

thoughts?

**mind you this has drifted way off OP's topic -- my fault -- sorry **
Logged
Of all the things I have lost, it is my mind that I miss the most.

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: Category/Sub-category Article count doesn't look right
« Reply #8 on: April 13, 2008, 09:29:00 AM »

Actually ... css ... fly-out ... ?

... but why in a 'menu' ?
thoughts?

I've said this before (in a less public place, but anyway) -- I'd prefer it if it was left to the imagination of the end developer how to present the cat/subcat thingy. For example, I've already had a situation (while testing!) when I wanted the option to show/hide subcats on any page, not just the cat index that actually involved subcats, if you take my meaning. It's sort of expected, by me anyway (if there is a cat menu, and cats have subcats, and the subcat menu is hidden, hovering over a cat link should show the subcat list. Whether I'm on index page or contact page or article page in a whole 'nother cat, shouldn't matter. Just show me that d#&??!&%%& subcat list.)

I've also had reason to want to present the subcat list in a spot entirely separate from the cat list -- which by default isn't possible either (it wasn't last time I checked, don't know if that has changed, if it has, my humble apologies) -- like when I click a cat link and land on the cat index, somewhere to the lower right, -- no further down, to the right, my right, there yes -- would be the subcat list. Visible from the start (no need to hide it on the catindex as imho).

Just a thought.
As for the numbers, I never display them on my own sites, so they have no meaning to me. YMMV, as always.
« Last Edit: April 13, 2008, 09:31:28 AM by Fred K (agentsmith) »
Logged

ecoza

  • Guest
Re: Category/Sub-category Article count doesn't look right
« Reply #9 on: August 03, 2008, 07:35:12 AM »

Code: [Select]
// DISPLAY CATEGORIES
function categories() {
....
....
while ($r = mysql_fetch_array($result)) {
$category_title = $r['seftitle'];
$class = $category_title == $categorySEF ? ' class="current"' : '';
if (isset($r['total'])) {
(+) $nn=mysql_fetch_array(mysql_query('SELECT count(*) FROM `articles` WHERE category IN (SELECT id FROM categories WHERE subcat='.$r['parent'].')'));
(+) $num='('.$nn[0].')';}
(*) echo '<li><a'.$class.' href="'._SITE.$category_title.'/" title="'.$r['description'].'">'.$r['name'].$num.'</a>';



Categories:
  XXXX (23)
    aaaa (1)
    bbbb (2)
    cccc (20)

Logged

Ken Dahlin

  • Full Member
  • ***
  • Karma: 30
  • Posts: 139
    • http://www.kendahlin.com/
Re: Category/Sub-category Article count doesn't look right
« Reply #10 on: August 03, 2008, 08:04:08 AM »

Code: [Select]
// DISPLAY CATEGORIES
function categories() {
....
....
while ($r = mysql_fetch_array($result)) {
$category_title = $r['seftitle'];
$class = $category_title == $categorySEF ? ' class="current"' : '';
if (isset($r['total'])) {
(+) $nn=mysql_fetch_array(mysql_query('SELECT count(*) FROM `articles` WHERE category IN (SELECT id FROM categories WHERE subcat='.$r['parent'].')'));
(+) $num='('.$nn[0].')';}
(*) echo '<li><a'.$class.' href="'._SITE.$category_title.'/" title="'.$r['description'].'">'.$r['name'].$num.'</a>';




Yep, that's the logical way to present the information in my opinion, and it query works fine... thanks
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: Category/Sub-category Article count doesn't look right
« Reply #11 on: August 24, 2008, 07:39:32 AM »

needs further exploration...
Query above didn't work for me (most likely my version of php/mysql)

but...
on collapsed category, show number for ALL articles found within.
on expanded category, show number relevant only to article locations...

Collapsed:
  XXXX (23)

Expanded:
  XXXX (3)
    aaaa (1)
    bbbb (2)
    cccc (17)
Logged
Of all the things I have lost, it is my mind that I miss the most.