A A
RSS

Category Count - Final

Sizzling Popcorn
Advertise Here

Posted on Mon, Apr 21, 2008 by User ImageGeoserv

Featured, Modules

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

This mod will list counts in your categories.tpl file that shows in your sidebar.

I have ONLY tested this in 9.8.2

Catcount

Find in libs/dbtree.php:

$row = $db->get_row($sql);
if(!$row){
die('There is a problem with the categories table. Error CA:001.');
}

}

after, add:

$catcount = $db->get_results("SELECT COUNT(l.link_category) as catcount, c.category_id FROM pligg_categories c LEFT JOIN pligg_links l ON c.category_id = l.link_category GROUP BY c.category_id"); # query to count the link_category

find,

foreach($result as $row){
if (count($right)>0) {
// check if we should remove a node from the stack
while ($right[count($right)-1]< $row->rgt) {
if (array_pop($right) == NULL) {
break; // We’ve reached the top of the category chain
}
}
}

after, add

foreach ($catcount as $v) # loop through the result and find the id that matches, if found then this is the associated category count
{
if ($v->category_id == $row->category__auto_id) { # found it, store it and break
$array[$i]['catcount'] = $v->catcount;

break;
}

in templates/yget/sidebar_modules/categories.tpl

find and add the parts bolded and italicized:

{if $pagename eq “published”}
{$cat_array[thecat].name}{if $cat_array[thecat].parent neq 0} ({$cat_array[thecat].catcount}) {/if}
{else}
{$cat_array[thecat].name}{if $cat_array[thecat].parent neq 0} ({$cat_array[thecat].catcount}) {/if}
{/if}

go to libs/smartyvariables and add:

// show count of category
#$catcount = $db->get_results('SELECT COUNT(l.link_category) as catcount, c.category_id FROM pligg_categories c LEFT JOIN pligg_links l ON c.category_id = l.link_category GROUP BY c.category_id');
#$catcount = $db->get_var('SELECT a1.Link_Category , b1.Category_Name , count( * ) TotPerCategory ' . ' from pligg_links a1 , pligg_categories b1 ' . ' where a1.Link_Category = b1.Category_ID ' . ' group by a1.Link_Category , b1.Category_Name ' . ' order by b1.Category_Name; ');

#$main_smarty->assign('catcount', $catcount);

Thats it.

Any issues post them here.

Geoserv.

Backup all files prior to applying this additions. I guarantee nothing and you are applying at your own risk.

Site5

Popularity: 27% [?]

Rate this:
2.5
Add to BlogEngage

Tags: ,

RSS feed for comments on this post. TrackBack URL

RELATED POSTS

Analog Clock

RELATED ADS

1 Comments For This Post

  1. no imageDavid Mackey (Check me out!) (1 comments.) Says:

    Pretty sweet…Now if it would just show how many are unread. :-)

    Rate this:
    2.9

1 Trackbacks For This Post

  1. Google - Pligg Forum Says:

    [...] fed to Google is what did it so quick. Anyone else have a similar result? Original post is at: Category Count | Pliggs Will try with my next post. Geoserv. __________________ http://www.newsdots.com | [...]

Leave a Reply


Comments protected by Lucia's Linky Love.



  RevResponse

Recent Droppers

My site was nominated for Best Blog About Stuff! 

Advertise Here
  • Identification

  • Template Downloads

  • Pligground (165.9 KiB, 91 hits)
  • Pligg News (168.5 KiB, 76 hits)
  • xTrend (155.5 KiB, 70 hits)
  • Pliggbook (165.9 KiB, 66 hits)
  • Pliggzee (165 KiB, 60 hits)
  • Pliggsign (173.1 KiB, 56 hits)
  • Pliggwick (166.6 KiB, 41 hits)
  • Pliggdark (165.9 KiB, 33 hits)


  • Advertise Here
  • Tip Jar

    Amount:

    Website(Optional):


    Top Commentators

    ss_blog_claim=285c07eded679892eda4007fcffd0402

    Users online

    Users: 1 Guest, 1 Bot

    Popularity: unranked [?]

    Rate this:
    2.5

    Popularity: unranked [?]

    Rate this:
    2.5

    Popularity: unranked [?]

    Rate this:
    2.5

    Popularity: unranked [?]

    Rate this:
    2.5

    Popularity: unranked [?]

    Rate this:
    2.5

    Comments protected by Lucia's Linky Love.

    Categories

    Archives