Get paid to search...we do!
Powered by MaxBlogPress Close 
A A
RSS

Category Count - Final

Social Web CMS
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: 30% [?]

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

SimplyWP   My Blogging Experience



  RevResponse

Advertise Here

Recent Droppers


My site was nominated for Best Blog About Stuff! 

Advertise Here
  • Identification

  • Template Downloads

  • Pligground (165.9 KiB, 246 hits)
  • xTrend (155.5 KiB, 212 hits)
  • Pligg News (168.5 KiB, 202 hits)
  • Pliggbook (165.9 KiB, 201 hits)
  • Pliggzee (165 KiB, 168 hits)
  • Pliggsign (173.1 KiB, 165 hits)
  • Pliggwick (166.6 KiB, 144 hits)
  • Pliggdark (165.9 KiB, 136 hits)
  • Pliggup v9.9.0 (336.6 KiB, 125 hits)
  • Pliggpaq v9.9.5 (306.4 KiB, 103 hits)
  • Pliggblogs (369.4 KiB, 57 hits)


  • Advertise Here
  • Tip Jar

    Amount:

    Website(Optional):


    Top Commentators




    fly.co.uk cheap flights from the uk to the whole world
    Visit Now Find Deals
    Qatar Flights Cheap Flight

    Popularity: 100% [?]

    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

    Categories

    Archives