categories widget can now show numbers: EXPERIMENTAL, it's just a show-off :p needs some caching system
This commit is contained in:
parent
29a9e6bbd1
commit
bf13a21d35
@ -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);
|
||||
|
@ -14,6 +14,15 @@ 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/
|
||||
$lang = lang_load('plugin:categories');
|
||||
|
@ -1 +1 @@
|
||||
{list_categories type=linked}
|
||||
{list_categories type=linked count=$categories_showcount}
|
||||
|
Loading…
x
Reference in New Issue
Block a user