categories widget can now show numbers: EXPERIMENTAL, it's just a show-off :p needs some caching system

This commit is contained in:
real_nowhereman 2008-09-08 15:32:15 +00:00
parent 29a9e6bbd1
commit bf13a21d35
3 changed files with 17 additions and 3 deletions

View File

@ -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='</a>';
if (isset($params['count']) && $params['count']) {
$index =& $fpdb->get_index($vid);
$count = ($index)? $index->length() : 0;
$after = " ($count) ". $after;
}
}
array_push($result, $after);

View File

@ -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/

View File

@ -1 +1 @@
{list_categories type=linked}
{list_categories type=linked count=$categories_showcount}