diff --git a/fp-includes/smarty/plugins/function.list_categories.php b/fp-includes/smarty/plugins/function.list_categories.php index f22eff5..eaab965 100755 --- a/fp-includes/smarty/plugins/function.list_categories.php +++ b/fp-includes/smarty/plugins/function.list_categories.php @@ -44,7 +44,7 @@ function smarty_function_list_categories($params) //, &$smarty) function do_print_categories_list(&$lines, &$indentstack, &$result, $params) { - global $_FP_SMARTY; + global $smarty, $fpdb; extract($params); @@ -89,7 +89,7 @@ function do_print_categories_list(&$lines, &$indentstack, &$result, $params) { array_push($result, $ild); - $cat_entry = $_FP_SMARTY->get_template_vars('categories'); + $cat_entry = $smarty->get_template_vars('categories'); if (!$cat_entry) $cat_entry = array(); //list($catId) = each($categories); @@ -121,6 +121,11 @@ function do_print_categories_list(&$lines, &$indentstack, &$result, $params) { $after = $string; }elseif(isset($params['type']) && $params['type']=='linked'){ $after=''; + if (isset($params['count']) && $params['count']) { + $index =& $fpdb->get_index($vid); + $count = ($index)? $index->length() : 0; + $after = " ($count) ". $after; + } } array_push($result, $after); diff --git a/fp-plugins/categories/plugin.categories.php b/fp-plugins/categories/plugin.categories.php index a704dc4..a53a948 100755 --- a/fp-plugins/categories/plugin.categories.php +++ b/fp-plugins/categories/plugin.categories.php @@ -13,6 +13,15 @@ Author URI: http://www.nowhereland.it/ function plugin_categories_widget() { global $smarty; + + // set this to true if you want show the number + // of categories for each category; please notice: + // not cheap on the server, it should be cached + // somewhere else + + // default: disabled + + $smarty->assign('categories_showcount', false); // load plugin strings // they're located under plugin.PLUGINNAME/lang/LANGID/ diff --git a/fp-plugins/categories/tpls/widget.tpl b/fp-plugins/categories/tpls/widget.tpl index a63a216..2556d79 100755 --- a/fp-plugins/categories/tpls/widget.tpl +++ b/fp-plugins/categories/tpls/widget.tpl @@ -1 +1 @@ -{list_categories type=linked} \ No newline at end of file +{list_categories type=linked count=$categories_showcount}