[Mod] Category Count - Final

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 01-28-2008, 12:53 AM
Banned
Pligg Version: 9.8.
Pligg Template: Custom
 
Join Date: Feb 2007
Location: Canada
Posts: 796
This mod will list counts in your categories.tpl file that shows in ytour sidebar.

I have ONLY tested this in 9.8.2

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

}
after, add:

Code:
$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,

Code:
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

Code:
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 in red:

Code:
{if $pagename eq "published"}
<strong><a style="padding-bottom:5px;" href="{$URL_maincategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a>{if $cat_array[thecat].parent neq 0} ({$cat_array[thecat].catcount}) {/if}</strong><br />
{else}
<strong><a style="padding-bottom:5px;" href="{$URL_queuedcategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a>{if $cat_array[thecat].parent neq 0} ({$cat_array[thecat].catcount}) {/if}</strong><br />
{/if}
go to libs/smartyvariables and add:

Code:
// 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.
Reply With Quote
  #2 (permalink)  
Old 01-28-2008, 12:54 AM
Banned
Pligg Version: 9.9.5
 
Join Date: Oct 2007
Location: Canada
Posts: 784
Have a demo of this Geoserv, also will it list total article count per category for both upcoming and published?
Reply With Quote
  #3 (permalink)  
Old 01-28-2008, 12:58 AM
Banned
Pligg Version: 9.8.
Pligg Template: Custom
 
Join Date: Feb 2007
Location: Canada
Posts: 796
A demo is located at News Dots / Published Dots

It shows the count for published and unpublished. But if you are in published, only published ones will be shown, and if you are in unpublished, only unpublished ones will be shown.

Geoserv.
Reply With Quote
  #4 (permalink)  
Old 03-02-2008, 07:20 PM
New Pligger
 
Join Date: Mar 2008
Posts: 1
can please someone code it for 9.90 ?? i relly need this!
Reply With Quote
  #5 (permalink)  
Old 03-30-2008, 03:21 PM
New Pligger
Pligg Version: 1.0
Pligg Template: Thestandard
 
Join Date: Mar 2008
Location: Germany
Posts: 6
Quote:
Originally Posted by DJ2FiNE View Post
can please someone code it for 9.90 ?? i relly need this!
Please !!!
Reply With Quote
  #6 (permalink)  
Old 04-13-2008, 09:08 AM
xiesi's Avatar
Constant Pligger
Pligg Version: 9.95
Pligg Template: yget + diy
 
Join Date: Jun 2007
Posts: 223
Send a message via MSN to xiesi
Parse error: syntax error, unexpected $end in E:\wwwroot\qelele\wwwroot\libs\dbtree.php on line 253
Reply With Quote
  #7 (permalink)  
Old 04-13-2008, 09:25 AM
Banned
Pligg Version: 9.8.
Pligg Template: Custom
 
Join Date: Feb 2007
Location: Canada
Posts: 796
What version of Pligg?

Geoserv.
Reply With Quote
  #8 (permalink)  
Old 04-13-2008, 10:22 AM
xiesi's Avatar
Constant Pligger
Pligg Version: 9.95
Pligg Template: yget + diy
 
Join Date: Jun 2007
Posts: 223
Send a message via MSN to xiesi
pligg 9.9.0
Reply With Quote
  #9 (permalink)  
Old 04-18-2008, 08:57 PM
Banned
Pligg Version: 9.9.5
 
Join Date: Oct 2007
Location: Canada
Posts: 784
I'm getting the following error when installing this mod!

Code:
Parse error: parse error, unexpected $ in /home/content/b/b/r/bbrian017/html/blogengage/libs/dbtree.php on line 253
Maybe I have done something wrong?

Line 253 is the following,

Code:
?>
I got the templates part to site right But it's only counting the sub categories it seems!

I'm running 9.8.2 and I trust your work so I must be doing something incorrectly.
Reply With Quote
  #10 (permalink)  
Old 04-18-2008, 09:18 PM
Banned
Pligg Version: 9.8.
Pligg Template: Custom
 
Join Date: Feb 2007
Location: Canada
Posts: 796
Sounds like you missed part of the code.

Geoserv.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Control of meta description - categories Divisive Cotton Questions and Comments 71 03-29-2011 10:03 PM
Pligg Categories Yankidank Wiki Articles 1 12-17-2008 11:10 AM
How to show category keywords as text on the site? gnalkit Questions and Comments 4 11-26-2008 06:17 AM
[mod] count clicks instead of votes abcdefgary Questions and Comments 6 06-15-2008 12:34 AM
[SOLVED] Digg-like story count at category tabs tbones Questions and Comments 2 07-30-2007 05:56 AM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development