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.');
}
} 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 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
}
}
} 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;
} 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} 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); 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.






But it's only counting the sub categories it seems!
Linear Mode




